Skip to content

Commit 36cb5e7

Browse files
committed
Update comments
Various places wanted to point out that tuple descriptors don't contain the variable-length fields of pg_attribute. This started when attacl was added, but more fields have been added since, and these comments haven't been kept up to date consistently. Reword so that the purpose is clearer and we don't have to keep updating them.
1 parent 99e4d24 commit 36cb5e7

File tree

3 files changed

+10
-8
lines changed

3 files changed

+10
-8
lines changed

src/backend/access/common/tupdesc.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -630,7 +630,7 @@ TupleDescInitEntry(TupleDesc desc,
630630
att->attisdropped = false;
631631
att->attislocal = true;
632632
att->attinhcount = 0;
633-
/* attacl, attoptions and attfdwoptions are not present in tupledescs */
633+
/* variable-length fields are not present in tupledescs */
634634

635635
tuple = SearchSysCache1(TYPEOID, ObjectIdGetDatum(oidtypeid));
636636
if (!HeapTupleIsValid(tuple))
@@ -691,7 +691,7 @@ TupleDescInitBuiltinEntry(TupleDesc desc,
691691
att->attisdropped = false;
692692
att->attislocal = true;
693693
att->attinhcount = 0;
694-
/* attacl, attoptions and attfdwoptions are not present in tupledescs */
694+
/* variable-length fields are not present in tupledescs */
695695

696696
att->atttypid = oidtypeid;
697697

src/backend/catalog/heap.c

+4-3
Original file line numberDiff line numberDiff line change
@@ -723,9 +723,10 @@ CheckAttributeType(const char *attname,
723723
* Construct and insert a set of tuples in pg_attribute.
724724
*
725725
* Caller has already opened and locked pg_attribute. tupdesc contains the
726-
* attributes to insert. attcacheoff is always initialized to -1, attacl,
727-
* attfdwoptions and attmissingval are always initialized to NULL. attoptions
728-
* must contain the same number of elements as tupdesc, or be NULL.
726+
* attributes to insert. attcacheoff is always initialized to -1. attoptions
727+
* supplies the values for the attoptions fields and must contain the same
728+
* number of elements as tupdesc or be NULL. The other variable-length fields
729+
* of pg_attribute are always initialized to null values.
729730
*
730731
* indstate is the index state for CatalogTupleInsertWithInfo. It can be
731732
* passed as NULL, in which case we'll fetch the necessary info. (Don't do

src/backend/commands/tablecmds.c

+4-3
Original file line numberDiff line numberDiff line change
@@ -6734,7 +6734,10 @@ ATExecAddColumn(List **wqueue, AlteredTableInfo *tab, Relation rel,
67346734
list_make1_oid(rel->rd_rel->reltype),
67356735
0);
67366736

6737-
/* construct new attribute's pg_attribute entry */
6737+
/*
6738+
* Construct new attribute's pg_attribute entry. (Variable-length fields
6739+
* are handled by InsertPgAttributeTuples().)
6740+
*/
67386741
attribute.attrelid = myrelid;
67396742
namestrcpy(&(attribute.attname), colDef->colname);
67406743
attribute.atttypid = typeOid;
@@ -6758,8 +6761,6 @@ ATExecAddColumn(List **wqueue, AlteredTableInfo *tab, Relation rel,
67586761
attribute.attinhcount = colDef->inhcount;
67596762
attribute.attcollation = collOid;
67606763

6761-
/* attribute.attacl is handled by InsertPgAttributeTuples() */
6762-
67636764
ReleaseSysCache(typeTuple);
67646765

67656766
tupdesc = CreateTupleDesc(lengthof(aattr), (FormData_pg_attribute **) &aattr);

0 commit comments

Comments
 (0)