diff options
Diffstat (limited to 'src/backend/access/common')
-rw-r--r-- | src/backend/access/common/heaptuple.c | 188 | ||||
-rw-r--r-- | src/backend/access/common/indextuple.c | 37 | ||||
-rw-r--r-- | src/backend/access/common/printtup.c | 21 | ||||
-rw-r--r-- | src/backend/access/common/tupdesc.c | 52 |
4 files changed, 146 insertions, 152 deletions
diff --git a/src/backend/access/common/heaptuple.c b/src/backend/access/common/heaptuple.c index 8b9714184c2..2ba59ab5e9e 100644 --- a/src/backend/access/common/heaptuple.c +++ b/src/backend/access/common/heaptuple.c @@ -6,7 +6,7 @@ * * NOTE: there is massive duplication of code in this module to * support both the convention that a null is marked by a bool TRUE, - * and the convention that a null is marked by a char 'n'. The latter + * and the convention that a null is marked by a char 'n'. The latter * convention is deprecated but it'll probably be a long time before * we can get rid of it entirely. * @@ -16,7 +16,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/access/common/heaptuple.c,v 1.99 2005/03/21 01:23:55 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/access/common/heaptuple.c,v 1.100 2005/10/15 02:49:08 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -452,8 +452,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++) { @@ -467,10 +467,9 @@ nocachegetattr(HeapTuple tuple, } /* - * If slow is false, and we got here, we know that we have a tuple - * 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. + * If slow is false, and we got here, we know that we have a tuple 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. */ if (!slow) { @@ -513,11 +512,11 @@ nocachegetattr(HeapTuple tuple, /* * Now we know that we have to walk the tuple CAREFULLY. * - * Note - This loop is a little tricky. For each non-null attribute, - * we have to first account for alignment padding before the attr, - * then advance over the attr based on its length. Nulls have no - * storage and no alignment padding either. We can use/set attcacheoff - * until we pass either a null or a var-width attribute. + * Note - This loop is a little tricky. For each non-null attribute, we + * have to first account for alignment padding before the attr, then + * advance over the attr based on its length. Nulls have no storage + * and no alignment padding either. We can use/set attcacheoff until + * we pass either a null or a var-width attribute. */ for (i = 0; i < attnum; i++) @@ -597,15 +596,13 @@ heap_getsysattr(HeapTuple tup, int attnum, TupleDesc tupleDesc, bool *isnull) break; /* - * If the attribute number is 0, then we are supposed to - * return the entire tuple as a row-type Datum. (Using zero - * for this purpose is unclean since it risks confusion with - * "invalid attr" result codes, but it's not worth changing - * now.) + * If the attribute number is 0, then we are supposed to return + * the entire tuple as a row-type Datum. (Using zero for this + * purpose is unclean since it risks confusion with "invalid attr" + * result codes, but it's not worth changing now.) * - * We have to make a copy of the tuple so we can safely insert - * the Datum overhead fields, which are not set in on-disk - * tuples. + * We have to make a copy of the tuple so we can safely insert the + * Datum overhead fields, which are not set in on-disk tuples. */ case InvalidAttrNumber: { @@ -708,15 +705,15 @@ heap_form_tuple(TupleDesc tupleDescriptor, numberOfAttributes, MaxTupleAttributeNumber))); /* - * Check for nulls and embedded tuples; expand any toasted attributes - * in embedded tuples. This preserves the invariant that toasting can - * only go one level deep. + * Check for nulls and embedded tuples; expand any toasted attributes in + * embedded tuples. This preserves the invariant that toasting can only + * go one level deep. * * We can skip calling toast_flatten_tuple_attribute() if the attribute * couldn't possibly be of composite type. All composite datums are - * varlena and have alignment 'd'; furthermore they aren't arrays. - * Also, if an attribute is already toasted, it must have been sent to - * disk already and so cannot contain toasted attributes. + * varlena and have alignment 'd'; furthermore they aren't arrays. Also, + * if an attribute is already toasted, it must have been sent to disk + * already and so cannot contain toasted attributes. */ for (i = 0; i < numberOfAttributes; i++) { @@ -757,8 +754,8 @@ heap_form_tuple(TupleDesc tupleDescriptor, tuple->t_data = td = (HeapTupleHeader) ((char *) tuple + HEAPTUPLESIZE); /* - * And fill in the information. Note we fill the Datum fields even - * though this tuple may never become a Datum. + * And fill in the information. Note we fill the Datum fields even though + * this tuple may never become a Datum. */ tuple->t_len = len; ItemPointerSetInvalid(&(tuple->t_self)); @@ -816,15 +813,15 @@ heap_formtuple(TupleDesc tupleDescriptor, numberOfAttributes, MaxTupleAttributeNumber))); /* - * Check for nulls and embedded tuples; expand any toasted attributes - * in embedded tuples. This preserves the invariant that toasting can - * only go one level deep. + * Check for nulls and embedded tuples; expand any toasted attributes in + * embedded tuples. This preserves the invariant that toasting can only + * go one level deep. * * We can skip calling toast_flatten_tuple_attribute() if the attribute * couldn't possibly be of composite type. All composite datums are - * varlena and have alignment 'd'; furthermore they aren't arrays. - * Also, if an attribute is already toasted, it must have been sent to - * disk already and so cannot contain toasted attributes. + * varlena and have alignment 'd'; furthermore they aren't arrays. Also, + * if an attribute is already toasted, it must have been sent to disk + * already and so cannot contain toasted attributes. */ for (i = 0; i < numberOfAttributes; i++) { @@ -865,8 +862,8 @@ heap_formtuple(TupleDesc tupleDescriptor, tuple->t_data = td = (HeapTupleHeader) ((char *) tuple + HEAPTUPLESIZE); /* - * And fill in the information. Note we fill the Datum fields even - * though this tuple may never become a Datum. + * And fill in the information. Note we fill the Datum fields even though + * this tuple may never become a Datum. */ tuple->t_len = len; ItemPointerSetInvalid(&(tuple->t_self)); @@ -917,15 +914,15 @@ heap_modify_tuple(HeapTuple tuple, HeapTuple newTuple; /* - * allocate and fill values and isnull arrays from either the tuple or - * the repl information, as appropriate. + * allocate and fill values and isnull arrays from either the tuple or the + * repl information, as appropriate. * * NOTE: it's debatable whether to use heap_deform_tuple() here or just - * heap_getattr() only the non-replaced colums. The latter could win - * if there are many replaced columns and few non-replaced ones. - * However, heap_deform_tuple costs only O(N) while the heap_getattr - * way would cost O(N^2) if there are many non-replaced columns, so it - * seems better to err on the side of linear cost. + * heap_getattr() only the non-replaced colums. The latter could win if + * there are many replaced columns and few non-replaced ones. However, + * heap_deform_tuple costs only O(N) while the heap_getattr way would cost + * O(N^2) if there are many non-replaced columns, so it seems better to + * err on the side of linear cost. */ values = (Datum *) palloc(numberOfAttributes * sizeof(Datum)); isnull = (bool *) palloc(numberOfAttributes * sizeof(bool)); @@ -950,8 +947,8 @@ heap_modify_tuple(HeapTuple tuple, pfree(isnull); /* - * copy the identification info of the old tuple: t_ctid, t_self, and - * OID (if any) + * copy the identification info of the old tuple: t_ctid, t_self, and OID + * (if any) */ newTuple->t_data->t_ctid = tuple->t_data->t_ctid; newTuple->t_self = tuple->t_self; @@ -986,15 +983,15 @@ heap_modifytuple(HeapTuple tuple, HeapTuple newTuple; /* - * allocate and fill values and nulls arrays from either the tuple or - * the repl information, as appropriate. + * allocate and fill values and nulls arrays from either the tuple or the + * repl information, as appropriate. * * NOTE: it's debatable whether to use heap_deformtuple() here or just - * heap_getattr() only the non-replaced colums. The latter could win - * if there are many replaced columns and few non-replaced ones. - * However, heap_deformtuple costs only O(N) while the heap_getattr - * way would cost O(N^2) if there are many non-replaced columns, so it - * seems better to err on the side of linear cost. + * heap_getattr() only the non-replaced colums. The latter could win if + * there are many replaced columns and few non-replaced ones. However, + * heap_deformtuple costs only O(N) while the heap_getattr way would cost + * O(N^2) if there are many non-replaced columns, so it seems better to + * err on the side of linear cost. */ values = (Datum *) palloc(numberOfAttributes * sizeof(Datum)); nulls = (char *) palloc(numberOfAttributes * sizeof(char)); @@ -1022,8 +1019,8 @@ heap_modifytuple(HeapTuple tuple, pfree(nulls); /* - * copy the identification info of the old tuple: t_ctid, t_self, and - * OID (if any) + * copy the identification info of the old tuple: t_ctid, t_self, and OID + * (if any) */ newTuple->t_data->t_ctid = tuple->t_data->t_ctid; newTuple->t_self = tuple->t_self; @@ -1068,9 +1065,9 @@ heap_deform_tuple(HeapTuple tuple, TupleDesc tupleDesc, natts = tup->t_natts; /* - * In inheritance situations, it is possible that the given tuple - * actually has more fields than the caller is expecting. Don't run - * off the end of the caller's arrays. + * In inheritance situations, it is possible that the given tuple actually + * has more fields than the caller is expecting. Don't run off the end of + * the caller's arrays. */ natts = Min(natts, tdesc_natts); @@ -1161,9 +1158,9 @@ heap_deformtuple(HeapTuple tuple, natts = tup->t_natts; /* - * In inheritance situations, it is possible that the given tuple - * actually has more fields than the caller is expecting. Don't run - * off the end of the caller's arrays. + * In inheritance situations, it is possible that the given tuple actually + * has more fields than the caller is expecting. Don't run off the end of + * the caller's arrays. */ natts = Min(natts, tdesc_natts); @@ -1228,22 +1225,22 @@ heap_deformtuple(HeapTuple tuple, static void slot_deform_tuple(TupleTableSlot *slot, int natts) { - HeapTuple tuple = slot->tts_tuple; - TupleDesc tupleDesc = slot->tts_tupleDescriptor; + HeapTuple tuple = slot->tts_tuple; + TupleDesc tupleDesc = slot->tts_tupleDescriptor; Datum *values = slot->tts_values; bool *isnull = slot->tts_isnull; - HeapTupleHeader tup = tuple->t_data; + HeapTupleHeader tup = tuple->t_data; bool hasnulls = HeapTupleHasNulls(tuple); Form_pg_attribute *att = tupleDesc->attrs; int attnum; - char *tp; /* ptr to tuple data */ - long off; /* offset in tuple data */ - bits8 *bp = tup->t_bits; /* ptr to null bitmap in tuple */ - bool slow; /* can we use/set attcacheoff? */ + char *tp; /* ptr to tuple data */ + long off; /* offset in tuple data */ + bits8 *bp = tup->t_bits; /* ptr to null bitmap in tuple */ + bool slow; /* can we use/set attcacheoff? */ /* - * Check whether the first call for this tuple, and initialize or - * restore loop state. + * Check whether the first call for this tuple, and initialize or restore + * loop state. */ attnum = slot->tts_nvalid; if (attnum == 0) @@ -1269,7 +1266,7 @@ slot_deform_tuple(TupleTableSlot *slot, int natts) { values[attnum] = (Datum) 0; isnull[attnum] = true; - slow = true; /* can't use attcacheoff anymore */ + slow = true; /* can't use attcacheoff anymore */ continue; } @@ -1290,7 +1287,7 @@ slot_deform_tuple(TupleTableSlot *slot, int natts) off = att_addlength(off, thisatt->attlen, tp + off); if (thisatt->attlen <= 0) - slow = true; /* can't use attcacheoff anymore */ + slow = true; /* can't use attcacheoff anymore */ } /* @@ -1316,9 +1313,9 @@ slot_deform_tuple(TupleTableSlot *slot, int natts) Datum slot_getattr(TupleTableSlot *slot, int attnum, bool *isnull) { - HeapTuple tuple = slot->tts_tuple; - TupleDesc tupleDesc = slot->tts_tupleDescriptor; - HeapTupleHeader tup; + HeapTuple tuple = slot->tts_tuple; + TupleDesc tupleDesc = slot->tts_tupleDescriptor; + HeapTupleHeader tup; /* * system attributes are handled by heap_getsysattr @@ -1349,18 +1346,18 @@ slot_getattr(TupleTableSlot *slot, int attnum, bool *isnull) } /* - * otherwise we had better have a physical tuple (tts_nvalid should - * equal natts in all virtual-tuple cases) + * otherwise we had better have a physical tuple (tts_nvalid should equal + * natts in all virtual-tuple cases) */ - if (tuple == NULL) /* internal error */ + if (tuple == NULL) /* internal error */ elog(ERROR, "cannot extract attribute from empty tuple slot"); /* * return NULL if attnum is out of range according to the tuple * - * (We have to check this separately because of various inheritance - * and table-alteration scenarios: the tuple could be either longer - * or shorter than the tupdesc.) + * (We have to check this separately because of various inheritance and + * table-alteration scenarios: the tuple could be either longer or shorter + * than the tupdesc.) */ tup = tuple->t_data; if (attnum > tup->t_natts) @@ -1379,10 +1376,9 @@ slot_getattr(TupleTableSlot *slot, int attnum, bool *isnull) } /* - * If the attribute's column has been dropped, we force a NULL - * result. This case should not happen in normal use, but it could - * happen if we are executing a plan cached before the column was - * dropped. + * If the attribute's column has been dropped, we force a NULL result. + * This case should not happen in normal use, but it could happen if we + * are executing a plan cached before the column was dropped. */ if (tupleDesc->attrs[attnum - 1]->attisdropped) { @@ -1420,11 +1416,11 @@ slot_getallattrs(TupleTableSlot *slot) return; /* - * otherwise we had better have a physical tuple (tts_nvalid should - * equal natts in all virtual-tuple cases) + * otherwise we had better have a physical tuple (tts_nvalid should equal + * natts in all virtual-tuple cases) */ tuple = slot->tts_tuple; - if (tuple == NULL) /* internal error */ + if (tuple == NULL) /* internal error */ elog(ERROR, "cannot extract attribute from empty tuple slot"); /* @@ -1467,11 +1463,11 @@ slot_getsomeattrs(TupleTableSlot *slot, int attnum) elog(ERROR, "invalid attribute number %d", attnum); /* - * otherwise we had better have a physical tuple (tts_nvalid should - * equal natts in all virtual-tuple cases) + * otherwise we had better have a physical tuple (tts_nvalid should equal + * natts in all virtual-tuple cases) */ tuple = slot->tts_tuple; - if (tuple == NULL) /* internal error */ + if (tuple == NULL) /* internal error */ elog(ERROR, "cannot extract attribute from empty tuple slot"); /* @@ -1502,8 +1498,8 @@ slot_getsomeattrs(TupleTableSlot *slot, int attnum) bool slot_attisnull(TupleTableSlot *slot, int attnum) { - HeapTuple tuple = slot->tts_tuple; - TupleDesc tupleDesc = slot->tts_tupleDescriptor; + HeapTuple tuple = slot->tts_tuple; + TupleDesc tupleDesc = slot->tts_tupleDescriptor; /* * system attributes are handled by heap_attisnull @@ -1528,10 +1524,10 @@ slot_attisnull(TupleTableSlot *slot, int attnum) return true; /* - * otherwise we had better have a physical tuple (tts_nvalid should - * equal natts in all virtual-tuple cases) + * otherwise we had better have a physical tuple (tts_nvalid should equal + * natts in all virtual-tuple cases) */ - if (tuple == NULL) /* internal error */ + if (tuple == NULL) /* internal error */ elog(ERROR, "cannot extract attribute from empty tuple slot"); /* and let the tuple tell it */ diff --git a/src/backend/access/common/indextuple.c b/src/backend/access/common/indextuple.c index e5d19765e79..b3520baa2bc 100644 --- a/src/backend/access/common/indextuple.c +++ b/src/backend/access/common/indextuple.c @@ -9,7 +9,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/access/common/indextuple.c,v 1.74 2005/03/27 18:38:26 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/access/common/indextuple.c,v 1.75 2005/10/15 02:49:08 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -70,20 +70,20 @@ index_form_tuple(TupleDesc tupleDescriptor, continue; /* - * If value is stored EXTERNAL, must fetch it so we are not - * depending on outside storage. This should be improved someday. + * If value is stored EXTERNAL, must fetch it so we are not depending + * on outside storage. This should be improved someday. */ if (VARATT_IS_EXTERNAL(values[i])) { untoasted_values[i] = PointerGetDatum( - heap_tuple_fetch_attr( - (varattrib *) DatumGetPointer(values[i]))); + heap_tuple_fetch_attr( + (varattrib *) DatumGetPointer(values[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_values[i]) > TOAST_INDEX_TARGET && !VARATT_IS_EXTENDED(untoasted_values[i]) && @@ -149,23 +149,23 @@ index_form_tuple(TupleDesc tupleDescriptor, /* * We do this because heap_fill_tuple 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. + * 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. */ if (tupmask & HEAP_HASVARWIDTH) infomask |= INDEX_VAR_MASK; /* - * Here we make sure that the size will fit in the field reserved for - * it in t_info. + * Here we make sure that the size will fit in the field reserved for it + * in t_info. */ if ((size & INDEX_SIZE_MASK) != size) ereport(ERROR, (errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED), - errmsg("index row requires %lu bytes, maximum size is %lu", - (unsigned long) size, - (unsigned long) INDEX_SIZE_MASK))); + errmsg("index row requires %lu bytes, maximum size is %lu", + (unsigned long) size, + (unsigned long) INDEX_SIZE_MASK))); infomask |= size; @@ -322,10 +322,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 var-widths before the target attribute. If - * possible, we also want to initialize the remainder of the attribute - * cached offset values. + * If slow is false, and we got here, we know that we have a tuple 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. */ if (!slow) { diff --git a/src/backend/access/common/printtup.c b/src/backend/access/common/printtup.c index 9080d047fc2..96dfafb7cbf 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 - * $PostgreSQL: pgsql/src/backend/access/common/printtup.c,v 1.91 2005/06/22 17:45:45 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/access/common/printtup.c,v 1.92 2005/10/15 02:49:08 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -78,9 +78,9 @@ printtup_create_DR(CommandDest dest, Portal portal) else { /* - * In protocol 2.0 the Bind message does not exist, so there is no - * way for the columns to have different print formats; it's - * sufficient to look at the first one. + * In protocol 2.0 the Bind message does not exist, so there is no way + * for the columns to have different print formats; it's sufficient to + * look at the first one. */ if (portal->formats && portal->formats[0] != 0) self->pub.receiveSlot = printtup_internal_20; @@ -113,8 +113,7 @@ printtup_startup(DestReceiver *self, int operation, TupleDesc typeinfo) if (PG_PROTOCOL_MAJOR(FrontendProtocol) < 3) { /* - * Send portal name to frontend (obsolete cruft, gone in proto - * 3.0) + * Send portal name to frontend (obsolete cruft, gone in proto 3.0) * * If portal name not specified, use "blank" portal. */ @@ -127,8 +126,8 @@ printtup_startup(DestReceiver *self, int operation, TupleDesc typeinfo) } /* - * If this is a retrieve, and we are supposed to emit row - * descriptions, then we send back the tuple descriptor of the tuples. + * If this is a retrieve, and we are supposed to emit row descriptions, + * then we send back the tuple descriptor of the tuples. */ if (operation == CMD_SELECT && myState->sendDescrip) SendRowDescriptionMessage(typeinfo, @@ -280,7 +279,7 @@ printtup_prepare_info(DR_printtup *myState, TupleDesc typeinfo, int numAttrs) static void printtup(TupleTableSlot *slot, DestReceiver *self) { - TupleDesc typeinfo = slot->tts_tupleDescriptor; + TupleDesc typeinfo = slot->tts_tupleDescriptor; DR_printtup *myState = (DR_printtup *) self; StringInfoData buf; int natts = typeinfo->natts; @@ -363,7 +362,7 @@ printtup(TupleTableSlot *slot, DestReceiver *self) static void printtup_20(TupleTableSlot *slot, DestReceiver *self) { - TupleDesc typeinfo = slot->tts_tupleDescriptor; + TupleDesc typeinfo = slot->tts_tupleDescriptor; DR_printtup *myState = (DR_printtup *) self; StringInfoData buf; int natts = typeinfo->natts; @@ -566,7 +565,7 @@ debugtup(TupleTableSlot *slot, DestReceiver *self) static void printtup_internal_20(TupleTableSlot *slot, DestReceiver *self) { - TupleDesc typeinfo = slot->tts_tupleDescriptor; + TupleDesc typeinfo = slot->tts_tupleDescriptor; DR_printtup *myState = (DR_printtup *) self; StringInfoData buf; int natts = typeinfo->natts; diff --git a/src/backend/access/common/tupdesc.c b/src/backend/access/common/tupdesc.c index fedc7ec4894..cfa455beec9 100644 --- a/src/backend/access/common/tupdesc.c +++ b/src/backend/access/common/tupdesc.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/access/common/tupdesc.c,v 1.111 2005/04/14 22:34:48 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/access/common/tupdesc.c,v 1.112 2005/10/15 02:49:08 momjian Exp $ * * NOTES * some of the executor utility code such as "ExecTypeFromTL" should be @@ -49,10 +49,10 @@ CreateTemplateTupleDesc(int natts, bool hasoid) * Allocate enough memory for the tuple descriptor, including the * attribute rows, and set up the attribute row pointers. * - * Note: we assume that sizeof(struct tupleDesc) is a multiple of - * the struct pointer alignment requirement, and hence we don't need - * to insert alignment padding between the struct and the array of - * attribute row pointers. + * Note: we assume that sizeof(struct tupleDesc) is a multiple of the struct + * pointer alignment requirement, and hence we don't need to insert + * alignment padding between the struct and the array of attribute row + * pointers. */ attroffset = sizeof(struct tupleDesc) + natts * sizeof(Form_pg_attribute); attroffset = MAXALIGN(attroffset); @@ -273,16 +273,16 @@ equalTupleDescs(TupleDesc tupdesc1, TupleDesc tupdesc2) Form_pg_attribute attr2 = tupdesc2->attrs[i]; /* - * We do not need to check every single field here: we can - * disregard attrelid and attnum (which were used to place the row - * in the attrs array in the first place). It might look like we - * could dispense with checking attlen/attbyval/attalign, since these - * are derived from atttypid; but in the case of dropped columns - * we must check them (since atttypid will be zero for all dropped - * columns) and in general it seems safer to check them always. + * We do not need to check every single field here: we can disregard + * attrelid and attnum (which were used to place the row in the attrs + * array in the first place). It might look like we could dispense + * with checking attlen/attbyval/attalign, since these are derived + * from atttypid; but in the case of dropped columns we must check + * them (since atttypid will be zero for all dropped columns) and in + * general it seems safer to check them always. * - * attcacheoff must NOT be checked since it's possibly not set - * in both copies. + * attcacheoff must NOT be checked since it's possibly not set in both + * copies. */ if (strcmp(NameStr(attr1->attname), NameStr(attr2->attname)) != 0) return false; @@ -332,9 +332,9 @@ equalTupleDescs(TupleDesc tupdesc1, TupleDesc tupdesc2) AttrDefault *defval2 = constr2->defval; /* - * 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. + * 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. */ for (j = 0; j < n; defval2++, j++) { @@ -355,9 +355,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++) { @@ -407,8 +407,8 @@ TupleDescInitEntry(TupleDesc desc, /* * Note: attributeName can be NULL, because the planner doesn't always - * fill in valid resname values in targetlists, particularly for - * resjunk attributes. + * fill in valid resname values in targetlists, particularly for resjunk + * attributes. */ if (attributeName != NULL) namestrcpy(&(att->attname), attributeName); @@ -482,8 +482,8 @@ BuildDescForRelation(List *schema) ColumnDef *entry = lfirst(l); /* - * for each entry in the list, get the name and type information - * from the list and have TupleDescInitEntry fill in the attribute + * for each entry in the list, get the name and type information from + * the list and have TupleDescInitEntry fill in the attribute * information we need. */ attnum++; @@ -508,8 +508,8 @@ BuildDescForRelation(List *schema) desc->attrs[attnum - 1]->attnotnull = entry->is_not_null; /* - * Note we copy only pre-cooked default expressions. Digestion of - * raw ones is someone else's problem. + * Note we copy only pre-cooked default expressions. Digestion of raw + * ones is someone else's problem. */ if (entry->cooked_default != NULL) { |