Update comments
authorPeter Eisentraut
Fri, 26 Nov 2021 08:57:23 +0000 (09:57 +0100)
committerPeter Eisentraut
Fri, 26 Nov 2021 08:57:23 +0000 (09:57 +0100)
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.

src/backend/access/common/tupdesc.c
src/backend/catalog/heap.c
src/backend/commands/tablecmds.c

index 4c63bd4dc641f276456c5ebb1a49e53f8411ecb3..9b506471fed93a0875129bb2adbb2caf76c0f5be 100644 (file)
@@ -630,7 +630,7 @@ TupleDescInitEntry(TupleDesc desc,
    att->attisdropped = false;
    att->attislocal = true;
    att->attinhcount = 0;
-   /* attacl, attoptions and attfdwoptions are not present in tupledescs */
+   /* variable-length fields are not present in tupledescs */
 
    tuple = SearchSysCache1(TYPEOID, ObjectIdGetDatum(oidtypeid));
    if (!HeapTupleIsValid(tuple))
@@ -691,7 +691,7 @@ TupleDescInitBuiltinEntry(TupleDesc desc,
    att->attisdropped = false;
    att->attislocal = true;
    att->attinhcount = 0;
-   /* attacl, attoptions and attfdwoptions are not present in tupledescs */
+   /* variable-length fields are not present in tupledescs */
 
    att->atttypid = oidtypeid;
 
index 81cc39fb70eb177f05657ec774a6e0824529a0cb..8bbf23e4526c11148a79ee9d28b2be706fc0733b 100644 (file)
@@ -723,9 +723,10 @@ CheckAttributeType(const char *attname,
  *     Construct and insert a set of tuples in pg_attribute.
  *
  * Caller has already opened and locked pg_attribute.  tupdesc contains the
- * attributes to insert.  attcacheoff is always initialized to -1, attacl,
- * attfdwoptions and attmissingval are always initialized to NULL.  attoptions
- * must contain the same number of elements as tupdesc, or be NULL.
+ * attributes to insert.  attcacheoff is always initialized to -1.  attoptions
+ * supplies the values for the attoptions fields and must contain the same
+ * number of elements as tupdesc or be NULL.  The other variable-length fields
+ * of pg_attribute are always initialized to null values.
  *
  * indstate is the index state for CatalogTupleInsertWithInfo.  It can be
  * passed as NULL, in which case we'll fetch the necessary info.  (Don't do
index 5e9cae26a0b7efc95ea0bc1f619a73511f43def5..c35f09998c4253bbe6e0245dcd696ad60d3e94e3 100644 (file)
@@ -6734,7 +6734,10 @@ ATExecAddColumn(List **wqueue, AlteredTableInfo *tab, Relation rel,
                       list_make1_oid(rel->rd_rel->reltype),
                       0);
 
-   /* construct new attribute's pg_attribute entry */
+   /*
+    * Construct new attribute's pg_attribute entry.  (Variable-length fields
+    * are handled by InsertPgAttributeTuples().)
+    */
    attribute.attrelid = myrelid;
    namestrcpy(&(attribute.attname), colDef->colname);
    attribute.atttypid = typeOid;
@@ -6758,8 +6761,6 @@ ATExecAddColumn(List **wqueue, AlteredTableInfo *tab, Relation rel,
    attribute.attinhcount = colDef->inhcount;
    attribute.attcollation = collOid;
 
-   /* attribute.attacl is handled by InsertPgAttributeTuples() */
-
    ReleaseSysCache(typeTuple);
 
    tupdesc = CreateTupleDesc(lengthof(aattr), (FormData_pg_attribute **) &aattr);