Re: [PATCH] Add pg_get_table_ddl() to reconstruct CREATE TABLE statements
Akshay Joshi <akshay.joshi@enterprisedb.com>
From: Akshay Joshi <akshay.joshi@enterprisedb.com>
To: Kyotaro Horiguchi <horikyota.ntt@gmail.com>
Cc: zsolt.parragi@percona.com, pgsql-hackers@lists.postgresql.org
Date: 2026-06-15T08:55:06Z
Lists: pgsql-hackers
Attachments
- v6-0001-Add-pg_get_table_ddl-to-reconstruct-CREATE-TABLE.patch (application/octet-stream) patch v6-0001
Hi Kyotaro and Zsolt, I have incorporated the feedback provided by both of you. The v6 patch is updated and ready for your review. On Fri, Jun 12, 2026 at 6:40 AM Kyotaro Horiguchi <horikyota.ntt@gmail.com> wrote: > Hello. > > At Thu, 11 Jun 2026 13:18:07 +0530, Akshay Joshi < > akshay.joshi@enterprisedb.com> wrote in > > Fixed the issue above. The v5 patch is ready for review/testing. > > I have not looked at the patch in detail, but I noticed that some > comments in the patch seem to contain non-ASCII characters. > > > * * re-emitting it as ALTER TABLE … ADD CONSTRAINT ― the column-emit > > I don't think that is recommended in PostgreSQL source comments, so > these should probably be replaced with plain ASCII equivalents. > > > https://www.postgresql.org/message-id/E1pnhhu-003D6z-Ki%40gemulon.postgresql.org > > For reference, I have attached the result of a quick search below. > > Regards, > > -- > Kyotaro Horiguchi > NTT Open Source Software Center > > > Quick search result: > > ========= > 20 matches in 18 lines for "[^[:ascii:]]" in buffer: > v5-0001-Add-pg_get_table_ddl-to-reconstruct-CREATE-TABLE.patch > 565:+ * re-emitting it as ALTER TABLE … ADD CONSTRAINT ― the > column-emit > 877:+ * defaults ― mirroring > pg_get_database_ddl's pattern of > 934:+ * SEQUENCE NAME ― > omit when it matches the implicit > 1042:+ * Table-level CHECK constraints ― emitted inline in the > CREATE TABLE > 1055:+ * applied per-column overrides ― DEFAULT, NOT NULL, > and any locally > 1155:+ * pg_get_ruledef, pg_get_statisticsobjdef_string) ― when > 1383:+ * ALTER TABLE qualname ALTER COLUMN col SET DEFAULT > expr ― one per > 1422:+ * ALTER TABLE qualname ALTER COLUMN col SET (...) ― > one per column > 1468:+ * out-of-line by emit_local_constraints (the ALTER > TABLE … ADD > 1500:+ * ALTER TABLE … ADD CONSTRAINT for each > locally-defined constraint > 1617:+ * ALTER TABLE qualname REPLICA IDENTITY … ― emitted > only when the > 1749:+ * (#if 0) ― they will become a single helper call once the > standalone > 1830:+ * Pre-compute "<schema>." too ― the always-qualified > helpers > 1884:+ * Triggers and row-level security policies ― disabled > until the > 2680:+-- quoting (its prefix starts with "). Both forms of the prefix ― > 2681:+-- bare-lowercase and quoted ― must be stripped from outer > 3197:+-- quoting (its prefix starts with "). Both forms of the prefix ― > 3198:+-- bare-lowercase and quoted ― must be stripped from outer > ========= >