diff options
Diffstat (limited to 'src/backend/access/common')
-rw-r--r-- | src/backend/access/common/heaptuple.c | 12 | ||||
-rw-r--r-- | src/backend/access/common/indextuple.c | 28 | ||||
-rw-r--r-- | src/backend/access/common/printtup.c | 27 | ||||
-rw-r--r-- | src/backend/access/common/tupdesc.c | 18 |
4 files changed, 44 insertions, 41 deletions
diff --git a/src/backend/access/common/heaptuple.c b/src/backend/access/common/heaptuple.c index 03d180e36fe..9bb08054943 100644 --- a/src/backend/access/common/heaptuple.c +++ b/src/backend/access/common/heaptuple.c @@ -9,7 +9,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/access/common/heaptuple.c,v 1.69 2001/01/24 19:42:46 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/access/common/heaptuple.c,v 1.70 2001/03/22 03:59:11 momjian Exp $ * * NOTES * The old interface functions have been converted to macros @@ -306,8 +306,8 @@ nocachegetattr(HeapTuple tuple, int j; /* - * In for(), we test <= and not < because we want to see - * if we can go past it in initializing offsets. + * In for(), we test <= and not < because we want to see if we + * can go past it in initializing offsets. */ for (j = 0; j <= attnum; j++) { @@ -321,9 +321,9 @@ 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, we - * also want to initialize the remainder of the attribute cached + * 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, + * we also want to initialize the remainder of the attribute cached * offset values. */ if (!slow) diff --git a/src/backend/access/common/indextuple.c b/src/backend/access/common/indextuple.c index e503d9b888d..da8129f307f 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.52 2001/02/22 21:48:48 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/access/common/indextuple.c,v 1.53 2001/03/22 03:59:11 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -45,9 +45,11 @@ index_formtuple(TupleDesc tupleDescriptor, bool hasnull = false; uint16 tupmask = 0; int numberOfAttributes = tupleDescriptor->natts; + #ifdef TOAST_INDEX_HACK Datum untoasted_value[INDEX_MAX_KEYS]; bool untoasted_free[INDEX_MAX_KEYS]; + #endif if (numberOfAttributes > INDEX_MAX_KEYS) @@ -57,7 +59,7 @@ index_formtuple(TupleDesc tupleDescriptor, #ifdef TOAST_INDEX_HACK for (i = 0; i < numberOfAttributes; i++) { - Form_pg_attribute att = tupleDescriptor->attrs[i]; + Form_pg_attribute att = tupleDescriptor->attrs[i]; untoasted_value[i] = value[i]; untoasted_free[i] = false; @@ -73,20 +75,20 @@ index_formtuple(TupleDesc tupleDescriptor, if (VARATT_IS_EXTERNAL(value[i])) { untoasted_value[i] = PointerGetDatum( - heap_tuple_fetch_attr( - (varattrib *) DatumGetPointer(value[i]))); + heap_tuple_fetch_attr( + (varattrib *) DatumGetPointer(value[i]))); untoasted_free[i] = true; } /* - * If value is above size target, and is of a compressible datatype, - * try to compress it in-line. + * If value is above size target, and is of a compressible + * datatype, try to compress it in-line. */ if (VARATT_SIZE(untoasted_value[i]) > TOAST_INDEX_TARGET && !VARATT_IS_EXTENDED(untoasted_value[i]) && (att->attstorage == 'x' || att->attstorage == 'm')) { - Datum cvalue = toast_compress_datum(untoasted_value[i]); + Datum cvalue = toast_compress_datum(untoasted_value[i]); if (DatumGetPointer(cvalue) != NULL) { @@ -146,8 +148,8 @@ index_formtuple(TupleDesc tupleDescriptor, /* * We do this because DataFill wants to initialize a "tupmask" which * is used for HeapTuples, but we want an indextuple infomask. The - * only relevant info is the "has variable attributes" field. - * We have already set the hasnull bit above. + * only relevant info is the "has variable attributes" field. We have + * already set the hasnull bit above. */ if (tupmask & HEAP_HASVARLENA) @@ -315,9 +317,9 @@ 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, we - * also want to initialize the remainder of the attribute cached + * 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, + * we also want to initialize the remainder of the attribute cached * offset values. */ if (!slow) @@ -391,9 +393,7 @@ nocache_index_getattr(IndexTuple tup, usecache = false; } else - { off += att[i]->attlen; - } } off = att_align(off, att[attnum]->attlen, att[attnum]->attalign); diff --git a/src/backend/access/common/printtup.c b/src/backend/access/common/printtup.c index 4f47ef0d451..d44bfe973e0 100644 --- a/src/backend/access/common/printtup.c +++ b/src/backend/access/common/printtup.c @@ -9,7 +9,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/access/common/printtup.c,v 1.57 2001/01/24 19:42:47 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/access/common/printtup.c,v 1.58 2001/03/22 03:59:11 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -51,7 +51,7 @@ getTypeOutputInfo(Oid type, Oid *typOutput, Oid *typElem, *typOutput = pt->typoutput; *typElem = pt->typelem; - *typIsVarlena = (! pt->typbyval) && (pt->typlen == -1); + *typIsVarlena = (!pt->typbyval) && (pt->typlen == -1); ReleaseSysCache(typeTuple); return OidIsValid(*typOutput); } @@ -200,9 +200,10 @@ printtup(HeapTuple tuple, TupleDesc typeinfo, DestReceiver *self) continue; if (OidIsValid(thisState->typoutput)) { + /* - * If we have a toasted datum, forcibly detoast it here to avoid - * memory leakage inside the type's output routine. + * If we have a toasted datum, forcibly detoast it here to + * avoid memory leakage inside the type's output routine. */ if (thisState->typisvarlena) attr = PointerGetDatum(PG_DETOAST_DATUM(origattr)); @@ -210,9 +211,9 @@ printtup(HeapTuple tuple, TupleDesc typeinfo, DestReceiver *self) attr = origattr; outputstr = DatumGetCString(FunctionCall3(&thisState->finfo, - attr, - ObjectIdGetDatum(thisState->typelem), - Int32GetDatum(typeinfo->attrs[i]->atttypmod))); + attr, + ObjectIdGetDatum(thisState->typelem), + Int32GetDatum(typeinfo->attrs[i]->atttypmod))); pq_sendcountedtext(&buf, outputstr, strlen(outputstr)); @@ -308,9 +309,10 @@ debugtup(HeapTuple tuple, TupleDesc typeinfo, DestReceiver *self) if (getTypeOutputInfo(typeinfo->attrs[i]->atttypid, &typoutput, &typelem, &typisvarlena)) { + /* - * If we have a toasted datum, forcibly detoast it here to avoid - * memory leakage inside the type's output routine. + * If we have a toasted datum, forcibly detoast it here to + * avoid memory leakage inside the type's output routine. */ if (typisvarlena) attr = PointerGetDatum(PG_DETOAST_DATUM(origattr)); @@ -318,9 +320,9 @@ debugtup(HeapTuple tuple, TupleDesc typeinfo, DestReceiver *self) attr = origattr; value = DatumGetCString(OidFunctionCall3(typoutput, - attr, - ObjectIdGetDatum(typelem), - Int32GetDatum(typeinfo->attrs[i]->atttypmod))); + attr, + ObjectIdGetDatum(typelem), + Int32GetDatum(typeinfo->attrs[i]->atttypmod))); printatt((unsigned) i + 1, typeinfo->attrs[i], value); @@ -405,6 +407,7 @@ printtup_internal(HeapTuple tuple, TupleDesc typeinfo, DestReceiver *self) /* send # of bytes, and opaque data */ if (thisState->typisvarlena) { + /* * If we have a toasted datum, must detoast before sending. */ diff --git a/src/backend/access/common/tupdesc.c b/src/backend/access/common/tupdesc.c index 86bc1a56f82..e07c6296d15 100644 --- a/src/backend/access/common/tupdesc.c +++ b/src/backend/access/common/tupdesc.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/access/common/tupdesc.c,v 1.71 2001/01/24 19:42:47 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/access/common/tupdesc.c,v 1.72 2001/03/22 03:59:11 momjian Exp $ * * NOTES * some of the executor utility code such as "ExecTypeFromTL" should be @@ -242,9 +242,9 @@ equalTupleDescs(TupleDesc tupdesc1, TupleDesc tupdesc2) /* * We do not need to check every single field here, and in fact * some fields such as attdispersion probably shouldn't be - * compared. We can also disregard attnum (it was used to - * place the row in the attrs array) and everything derived - * from the column datatype. + * compared. We can also disregard attnum (it was used to place + * the row in the attrs array) and everything derived from the + * column datatype. */ if (strcmp(NameStr(attr1->attname), NameStr(attr2->attname)) != 0) return false; @@ -276,8 +276,8 @@ equalTupleDescs(TupleDesc tupdesc1, TupleDesc tupdesc2) /* * We can't assume that the items are always read from the - * system catalogs in the same order; so use the adnum field to - * identify the matching item to compare. + * system catalogs in the same order; so use the adnum field + * to identify the matching item to compare. */ for (j = 0; j < n; defval2++, j++) { @@ -298,9 +298,9 @@ equalTupleDescs(TupleDesc tupdesc1, TupleDesc tupdesc2) ConstrCheck *check2 = constr2->check; /* - * Similarly, don't assume that the checks are always read - * in the same order; match them up by name and contents. - * (The name *should* be unique, but...) + * Similarly, don't assume that the checks are always read in + * the same order; match them up by name and contents. (The + * name *should* be unique, but...) */ for (j = 0; j < n; check2++, j++) { |