pgsql: Generalize handling of nullable pg_attribute columns in DDL

From: Peter Eisentraut <peter(at)eisentraut(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Generalize handling of nullable pg_attribute columns in DDL
Date: 2024-03-17 11:53:21
Message-ID: E1rlp4q-004H0r-Mw@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Generalize handling of nullable pg_attribute columns in DDL

DDL code uses tuple descriptors to pass around pg_attribute values
during table and index creation. But tuple descriptors don't include
the variable-length/nullable columns of pg_attribute, so they have to
be handled separately. Right now, the attoptions field is handled in
a one-off way with a separate argument passed to
InsertPgAttributeTuples(). The other affected fields of pg_attribute
are right now not needed at relation creation time.

The goal of this patch is to generalize this to allow handling
additional variable-length/nullable columns of pg_attribute in a
similar manner. For that, create a new struct
FormExtraData_pg_attribute, which is to be passed around in parallel
to the tuple descriptor and optionally supplies the additional
columns. Right now, this struct only contains one field for
attoptions, so no functionality is actually changed by this.

Reviewed-by: Tomas Vondra <tomas(dot)vondra(at)enterprisedb(dot)com>
Discussion: https://www.postgresql.org/message-id/flat/4da8d211-d54d-44b9-9847-f2a9f1184c76(at)eisentraut(dot)org

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/d939cb2fd612acde0304913213cfbdb01994e682

Modified Files
--------------
src/backend/catalog/heap.c | 21 ++++++++++++++-------
src/backend/catalog/index.c | 16 +++++++++++++++-
src/include/catalog/heap.h | 2 +-
src/include/catalog/pg_attribute.h | 13 +++++++++++++
src/tools/pgindent/typedefs.list | 1 +
5 files changed, 44 insertions(+), 9 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Dean Rasheed 2024-03-17 14:04:41 pgsql: Add RETURNING support to MERGE.
Previous Message Dean Rasheed 2024-03-17 10:23:17 pgsql: Fix EXPLAIN output for subplans in MERGE.