1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-15 03:41:20 +03:00

Clean up comments to be careful about the distinction between variable-

width types and varlena types, since with the introduction of CSTRING as
a more-or-less-real type, these concepts aren't identical.  I've tried to
use varlena consistently to denote datatypes with typlen = -1, ie, they
have a length word and are potentially TOASTable; while the term variable
width covers both varlena and cstring (and, perhaps, someday other types
with other rules for computing the actual width).  No code changes in this
commit except for renaming a couple macros.
This commit is contained in:
Tom Lane
2002-08-25 17:20:01 +00:00
parent d46172e4fa
commit 58de480999
11 changed files with 66 additions and 68 deletions

View File

@@ -9,7 +9,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/common/heaptuple.c,v 1.79 2002/08/24 15:00:45 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/access/common/heaptuple.c,v 1.80 2002/08/25 17:20:00 tgl Exp $
*
* NOTES
* The old interface functions have been converted to macros
@@ -116,7 +116,7 @@ DataFill(char *data,
else if (att[i]->attlen == -1)
{
/* varlena */
*infomask |= HEAP_HASVARLENA;
*infomask |= HEAP_HASVARWIDTH;
if (VARATT_IS_EXTERNAL(value[i]))
*infomask |= HEAP_HASEXTERNAL;
if (VARATT_IS_COMPRESSED(value[i]))
@@ -127,7 +127,7 @@ DataFill(char *data,
else if (att[i]->attlen == -2)
{
/* cstring */
*infomask |= HEAP_HASVARLENA;
*infomask |= HEAP_HASVARWIDTH;
data_length = strlen(DatumGetCString(value[i])) + 1;
memcpy(data, DatumGetPointer(value[i]), data_length);
}
@@ -230,9 +230,9 @@ nocachegetattr(HeapTuple tuple,
/* ----------------
* Three cases:
*
* 1: No nulls and no variable length attributes.
* 2: Has a null or a varlena AFTER att.
* 3: Has nulls or varlenas BEFORE att.
* 1: No nulls and no variable-width attributes.
* 2: Has a null or a var-width AFTER att.
* 3: Has nulls or var-widths BEFORE att.
* ----------------
*/
@@ -326,7 +326,7 @@ nocachegetattr(HeapTuple tuple,
/*
* If slow is false, and we got here, we know that we have a tuple
* with no nulls or varlenas before the target attribute. If possible,
* with no nulls or var-widths before the target attribute. If possible,
* we also want to initialize the remainder of the attribute cached
* offset values.
*/

View File

@@ -9,7 +9,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/common/indextuple.c,v 1.58 2002/08/24 15:00:45 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/access/common/indextuple.c,v 1.59 2002/08/25 17:20:00 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -151,7 +151,7 @@ index_formtuple(TupleDesc tupleDescriptor,
* already set the hasnull bit above.
*/
if (tupmask & HEAP_HASVARLENA)
if (tupmask & HEAP_HASVARWIDTH)
infomask |= INDEX_VAR_MASK;
/*
@@ -211,9 +211,9 @@ nocache_index_getattr(IndexTuple tup,
/* ----------------
* Three cases:
*
* 1: No nulls and no variable length attributes.
* 2: Has a null or a varlena AFTER att.
* 3: Has nulls or varlenas BEFORE att.
* 1: No nulls and no variable-width attributes.
* 2: Has a null or a var-width AFTER att.
* 3: Has nulls or var-widths BEFORE att.
* ----------------
*/
@@ -302,7 +302,7 @@ nocache_index_getattr(IndexTuple tup,
return fetchatt(att[attnum],
tp + att[attnum]->attcacheoff);
}
else if (IndexTupleHasVarlenas(tup))
else if (IndexTupleHasVarwidths(tup))
{
int j;
@@ -319,7 +319,7 @@ nocache_index_getattr(IndexTuple tup,
/*
* If slow is false, and we got here, we know that we have a tuple
* with no nulls or varlenas before the target attribute. If possible,
* with no nulls or var-widths before the target attribute. If possible,
* we also want to initialize the remainder of the attribute cached
* offset values.
*/

View File

@@ -7,7 +7,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/trigger.c,v 1.128 2002/08/22 00:01:42 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/commands/trigger.c,v 1.129 2002/08/25 17:20:00 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -261,7 +261,7 @@ CreateTrigger(CreateTrigStmt *stmt, bool forConstraint)
foreach(le, stmt->args)
{
char *ar = ((Value *) lfirst(le))->val.str;
char *ar = strVal(lfirst(le));
len += strlen(ar) + 4;
for (; *ar; ar++)
@@ -274,7 +274,7 @@ CreateTrigger(CreateTrigStmt *stmt, bool forConstraint)
args[0] = '\0';
foreach(le, stmt->args)
{
char *s = ((Value *) lfirst(le))->val.str;
char *s = strVal(lfirst(le));
char *d = args + strlen(args);
while (*s)
@@ -653,8 +653,6 @@ RelationBuildTriggers(Relation relation)
ScanKeyData skey;
SysScanDesc tgscan;
HeapTuple htup;
struct varlena *val;
bool isnull;
triggers = (Trigger *) MemoryContextAlloc(CacheMemoryContext,
ntrigs * sizeof(Trigger));
@@ -702,12 +700,14 @@ RelationBuildTriggers(Relation relation)
FUNC_MAX_ARGS * sizeof(int16));
if (build->tgnargs > 0)
{
bytea *val;
bool isnull;
char *p;
int i;
val = (struct varlena *) fastgetattr(htup,
Anum_pg_trigger_tgargs,
tgrel->rd_att, &isnull);
val = (bytea *) fastgetattr(htup,
Anum_pg_trigger_tgargs,
tgrel->rd_att, &isnull);
if (isnull)
elog(ERROR, "RelationBuildTriggers: tgargs IS NULL for rel %s",
RelationGetRelationName(relation));

View File

@@ -6,7 +6,7 @@
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $Header: /cvsroot/pgsql/src/backend/commands/user.c,v 1.107 2002/08/05 03:29:17 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/commands/user.c,v 1.108 2002/08/25 17:20:01 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -50,7 +50,7 @@ static List *IdArrayToList(IdList *oldarray);
* fputs_quote
*
* Outputs string in quotes, with double-quotes duplicated.
* We could use quote_ident(), but that expects varlena.
* We could use quote_ident(), but that expects a TEXT argument.
*/
static void fputs_quote(char *str, FILE *fp)
{

View File

@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/libpq/be-fsstubs.c,v 1.61 2002/06/20 20:29:28 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/libpq/be-fsstubs.c,v 1.62 2002/08/25 17:20:01 tgl Exp $
*
* NOTES
* This should be moved to a more appropriate place. It is here
@@ -313,24 +313,24 @@ loread(PG_FUNCTION_ARGS)
{
int32 fd = PG_GETARG_INT32(0);
int32 len = PG_GETARG_INT32(1);
struct varlena *retval;
bytea *retval;
int totalread;
if (len < 0)
len = 0;
retval = (struct varlena *) palloc(VARHDRSZ + len);
retval = (bytea *) palloc(VARHDRSZ + len);
totalread = lo_read(fd, VARDATA(retval), len);
VARATT_SIZEP(retval) = totalread + VARHDRSZ;
PG_RETURN_POINTER(retval);
PG_RETURN_BYTEA_P(retval);
}
Datum
lowrite(PG_FUNCTION_ARGS)
{
int32 fd = PG_GETARG_INT32(0);
struct varlena *wbuf = PG_GETARG_VARLENA_P(1);
bytea *wbuf = PG_GETARG_BYTEA_P(1);
int bytestowrite;
int totalwritten;

View File

@@ -9,7 +9,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/storage/large_object/inv_api.c,v 1.94 2002/08/05 03:29:17 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/storage/large_object/inv_api.c,v 1.95 2002/08/25 17:20:01 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -396,7 +396,7 @@ inv_write(LargeObjectDesc *obj_desc, char *buf, int nbytes)
bool pfreeit;
struct
{
struct varlena hdr;
bytea hdr;
char data[LOBLKSIZE];
} workbuf;
char *workb = VARATT_DATA(&workbuf.hdr);