pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Alvaro Herrera <alvherre@alvh.no-ip.org>
To: pgsql-committers@postgresql.org
Subject: pgsql: Remove hard-coded schema knowledge about pg_attribute from genbk
Date: Fri, 12 Jan 2018 14:22:08 +0000
Message-ID: <E1ea0Dg-0006DO-HW@gemulon.postgresql.org> (raw)

Remove hard-coded schema knowledge about pg_attribute from genbki.pl

Add the ability to label a column's default value in the catalog header,
and implement this for pg_attribute.  A new function in Catalog.pm is
used to fill in a tuple with defaults.  The build process will complain
loudly if a catalog entry is incomplete,

Commit 8137f2c3232 labeled variable length columns for the C preprocessor.
Expose that label to genbki.pl so we can exclude those columns from schema
macros in a general fashion. Also, format schema macro entries according
to their types.

This means slightly less code maintenance, but more importantly it's a
proving ground for mechanisms intended to be used in later commits.

While at it, I (Álvaro) couldn't resist making some changes in
genbki.pl: rename some functions to actually indicate their purpose
instead of actively misleading onlookers; and don't iterate on the whole
of pg_type to find the entry for each catalog row, using a hash instead
of an array.

Author: John Naylor, some changes by Álvaro Herrera
Discussion: https://postgr.es/m/CAJVSVGVJHwD8sfDfZW9TbCHWKf=C1YDRM-rF=2JenRU_y+VcFg@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/49c784ece766781250224a371be14af71e7eda93

Modified Files
--------------
src/backend/catalog/Catalog.pm     |  70 +++++++++++-
src/backend/catalog/genbki.pl      | 228 ++++++++++++++++++-------------------
src/include/catalog/genbki.h       |   3 +
src/include/catalog/pg_attribute.h |  22 ++--
4 files changed, 187 insertions(+), 136 deletions(-)



Message-ID: <E1ea0Dg-0006DO-HW@gemulon.postgresql.org>
Permalink:  ../E1ea0Dg-0006DO-HW@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1ea0Dg-0006DO-HW@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: alvherre@alvh.no-ip.org
  Subject: Re: pgsql: Remove hard-coded schema knowledge about pg_attribute from genbk
  In-Reply-To: <E1ea0Dg-0006DO-HW@gemulon.postgresql.org>
  References: <E1ea0Dg-0006DO-HW@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox