public inbox for [email protected]
help / color / mirror / Atom feedFrom: Akshay Joshi <[email protected]>
To: Kyotaro Horiguchi <[email protected]>
Cc: [email protected]
Cc: [email protected]
Subject: Re: [PATCH] Add pg_get_table_ddl() to reconstruct CREATE TABLE statements
Date: Thu, 2 Jul 2026 14:18:06 +0530
Message-ID: <CANxoLDceK1w3DVbCPyricQuVKjx1qeKoWUKqyx5uoMQ8=6yguQ@mail.gmail.com> (raw)
In-Reply-To: <[email protected]>
References: <CANxoLDd0KT+5fHOyTi0Fu5Jwme0+a5S2aAVj=iCVsqkpvF_2TA@mail.gmail.com>
<CAN4CZFPxokhJ2vTiTu9Bhj+v7T+5jZd4pjT7QXdjoZ4Vqv5KhQ@mail.gmail.com>
<CANxoLDdVEjCCKch1O-5J6ghw89b2fkWC1ADPYTUwxu8WB-hQbw@mail.gmail.com>
<[email protected]>
On Thu, Jul 2, 2026 at 7:47 AM Kyotaro Horiguchi <[email protected]>
wrote:
> Hello,
>
> Looking at this, one thing that concerns me is the large amount of
> overlap with dumpTableSchema() in pg_dump.
>
> I wonder if it would make sense to separate the SQL generation logic
> into frontend/backend-shared code so that it could also be used by
> pg_dump. The catalog lookup would naturally remain separate, but
> sharing the DDL generation itself would significantly reduce the
> duplication.
>
Thanks for the suggestion. The overlap is real, but sharing the SQL
generation logic at the C level runs into a few structural mismatches:
dumpTableSchema drives column rendering off pre-populated TableInfo arrays
that pg_dump bulk-loaded at startup, while the backend function uses live
syscache lookups - a shared builder would need an adapter layer roughly as
large as the code it replaces. The pattern PostgreSQL already uses for this
kind of sharing is to call backend pg_get_*def functions via SQL from
pg_dump — it already does this 20 times for indexes, constraints, triggers,
rules, and statistics. The natural long-term path would be for pg_dump to
call pg_get_table_ddl() the same way and retire dumpTableSchema, but that
is a substantial refactor in its own right and feels out of scope here.
By the way, a couple of comments use a Unicode RIGHTWARDS ARROW
> (U+2192). Please use an ASCII equivalent instead.
>
Will fix it in the next v15 patch.
>
> Regards,
>
> --
> Kyotaro Horiguchi
> NTT Open Source Software Center
>
view thread (54+ messages) latest in thread
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 using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected], [email protected], [email protected]
Subject: Re: [PATCH] Add pg_get_table_ddl() to reconstruct CREATE TABLE statements
In-Reply-To: <CANxoLDceK1w3DVbCPyricQuVKjx1qeKoWUKqyx5uoMQ8=6yguQ@mail.gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox