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

From: Akshay Joshi <akshay(dot)joshi(at)enterprisedb(dot)com>
To: Marcos Pegoraro <marcos(at)f10(dot)com(dot)br>
Cc: Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>, li(dot)evan(dot)chao(at)gmail(dot)com, zsolt(dot)parragi(at)percona(dot)com, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: [PATCH] Add pg_get_table_ddl() to reconstruct CREATE TABLE statements
Date: 2026-06-24 08:23:13
Message-ID: CANxoLDcRacGAd2Rsmnp=CZjaLMiz7sbCHYo95Rto1OMwJJeOmg@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Jun 23, 2026 at 7:33 PM Marcos Pegoraro <marcos(at)f10(dot)com(dot)br> wrote:

> Em ter., 23 de jun. de 2026 às 10:34, Akshay Joshi <
> akshay(dot)joshi(at)enterprisedb(dot)com> escreveu:
>
>> A quick note on a design change I made in the *pg_get_table_ddl* option
>> surface
>>
>
> Much better now.
>
> All options can be present or omitted, so why couldn't the owner also be
> part of the include/exclude options too ?
>
> Just one addition, some options are plural and others are not.
> We have indexes, policies, triggers, but we also have check, unique,
> exclusion.
> You don't know how many indices or checks you have, so wouldn't it be
> better to have them in singular form ?
>

Regarding moving owner into the include/exclude syntax, I prefer keeping it
as a top-level boolean for now:
1) It aligns with existing sibling functions (pg_get_role_ddl,
pg_get_tablespace_ddl, and pg_get_database_ddl), which all use a boolean
owner.
2) Existing regression tests and early callers pass owner => false for
output stability. Moving this into the exclude list would create
unnecessary churn that I'd prefer to avoid bundling here.

As for the naming inconsistency (singular vs. plural), you're entirely
right mixing indexes/policies/triggers with checks/uniques/exclusions was
an oversight. Note that I left statistics alone to match the CREATE
STATISTICS keyword.

I'll address the naming consistency in the next patch.

>
> regards
> Marcos
>

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Fujii Masao 2026-06-24 08:23:36 Re: psql: add tab completion for subscription wal_receiver_timeout
Previous Message Xuneng Zhou 2026-06-24 07:52:04 Re: psql: add tab completion for subscription wal_receiver_timeout