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/indextuple.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/indextuple.c')
-rw-r--r-- | src/backend/access/common/indextuple.c | 36 |
1 files changed, 16 insertions, 20 deletions
diff --git a/src/backend/access/common/indextuple.c b/src/backend/access/common/indextuple.c index d47c2e2d2f9..a0d2dc8ef7e 100644 --- a/src/backend/access/common/indextuple.c +++ b/src/backend/access/common/indextuple.c @@ -9,7 +9,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/access/common/indextuple.c,v 1.57 2002/06/20 20:29:24 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/access/common/indextuple.c,v 1.58 2002/08/24 15:00:45 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -64,7 +64,7 @@ index_formtuple(TupleDesc tupleDescriptor, untoasted_free[i] = false; /* Do nothing if value is NULL or not of varlena type */ - if (null[i] != ' ' || att->attlen >= 0) + if (null[i] != ' ' || att->attlen != -1) continue; /* @@ -243,9 +243,10 @@ nocache_index_getattr(IndexTuple tup, #endif } else - { /* there's a null somewhere in the tuple */ - + { /* + * there's a null somewhere in the tuple + * * check to see if desired att is null */ @@ -291,8 +292,9 @@ nocache_index_getattr(IndexTuple tup, tp = (char *) tup + data_off; - /* now check for any non-fixed length attrs before our attribute */ - + /* + * now check for any non-fixed length attrs before our attribute + */ if (!slow) { if (att[attnum]->attcacheoff != -1) @@ -305,11 +307,13 @@ nocache_index_getattr(IndexTuple tup, int j; for (j = 0; j < attnum; j++) + { if (att[j]->attlen <= 0) { slow = true; break; } + } } } @@ -337,12 +341,7 @@ nocache_index_getattr(IndexTuple tup, for (; j <= attnum; j++) { - /* - * Fix me when going to a machine with more than a four-byte - * word! - */ - - off = att_align(off, att[j]->attlen, att[j]->attalign); + off = att_align(off, att[j]->attalign); att[j]->attcacheoff = off; @@ -377,22 +376,19 @@ nocache_index_getattr(IndexTuple tup, off = att[i]->attcacheoff; else { - off = att_align(off, att[i]->attlen, att[i]->attalign); + off = att_align(off, att[i]->attalign); if (usecache) att[i]->attcacheoff = off; } - if (att[i]->attlen == -1) - { - off += VARSIZE(tp + off); + off = att_addlength(off, att[i]->attlen, tp + off); + + if (usecache && att[i]->attlen <= 0) usecache = false; - } - else - off += att[i]->attlen; } - off = att_align(off, att[attnum]->attlen, att[attnum]->attalign); + off = att_align(off, att[attnum]->attalign); return fetchatt(att[attnum], tp + off); } |