diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2002-08-24 15:00:47 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2002-08-24 15:00:47 +0000 |
commit | 976246cc7e4d8b673fc62fe6daa61c76d94af1af (patch) | |
tree | b61ea3f5bbd8fa025587754bc90c3fd43889337c /src/backend/access/common/printtup.c | |
parent | cf4d885c67744637d82f6fec657e8205578c5905 (diff) | |
download | postgresql-976246cc7e4d8b673fc62fe6daa61c76d94af1af.tar.gz postgresql-976246cc7e4d8b673fc62fe6daa61c76d94af1af.zip |
The cstring datatype can now be copied, passed around, etc. The typlen
value '-2' is used to indicate a variable-width type whose width is
computed as strlen(datum)+1. Everything that looks at typlen is updated
except for array support, which Joe Conway is working on; at the moment
it wouldn't work to try to create an array of cstring.
Diffstat (limited to 'src/backend/access/common/printtup.c')
-rw-r--r-- | src/backend/access/common/printtup.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/backend/access/common/printtup.c b/src/backend/access/common/printtup.c index 6fbce87be7c..db4187dba44 100644 --- a/src/backend/access/common/printtup.c +++ b/src/backend/access/common/printtup.c @@ -9,7 +9,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/access/common/printtup.c,v 1.63 2002/08/22 00:01:41 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/access/common/printtup.c,v 1.64 2002/08/24 15:00:46 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -457,9 +457,15 @@ printtup_internal(HeapTuple tuple, TupleDesc typeinfo, DestReceiver *self) } else { - /* fixed size */ + /* fixed size or cstring */ attr = origattr; len = typeinfo->attrs[i]->attlen; + if (len <= 0) + { + /* it's a cstring */ + Assert(len == -2 && !typeinfo->attrs[i]->attbyval); + len = strlen(DatumGetCString(attr)) + 1; + } pq_sendint(&buf, len, sizeof(int32)); if (typeinfo->attrs[i]->attbyval) { |