Re: [PATCH] Add pg_get_table_ddl() to reconstruct CREATE TABLE statements

Kyotaro Horiguchi <horikyota.ntt@gmail.com>

From: Kyotaro Horiguchi <horikyota.ntt@gmail.com>
To: akshay.joshi@enterprisedb.com
Cc: zsolt.parragi@percona.com, pgsql-hackers@lists.postgresql.org
Date: 2026-07-02T02:17:15Z
Lists: pgsql-hackers
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.

By the way, a couple of comments use a Unicode RIGHTWARDS ARROW
(U+2192). Please use an ASCII equivalent instead.

Regards,

-- 
Kyotaro Horiguchi
NTT Open Source Software Center