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

From: Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>
To: akshay(dot)joshi(at)enterprisedb(dot)com
Cc: 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-23 07:21:04
Message-ID: 20260623.162104.775158751399277188.horikyota.ntt@gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

At Mon, 22 Jun 2026 18:10:53 +0530, Akshay Joshi <akshay(dot)joshi(at)enterprisedb(dot)com> wrote in
> The v9 patch is ready for review.

I have not looked closely at the DDL generation logic itself, but I
have a few comments on how pg_get_table_ddl handles its options.

Since pg_get_table_ddl_internal() appears to copy these values into
TableDdlContext almost immediately, I wonder whether TableDdlContext
could be initialized by the caller instead.

Using positional boolean arguments is probably fine when there are
only a handful of options, but with around fifteen of them the current
approach seems somewhat error-prone.

It might also be clearer to initialize the default values first, and
then override only the fields corresponding to explicitly specified
options, rather than folding the default handling and option lookup
into the same expression.

Regards,

--
Kyotaro Horiguchi
NTT Open Source Software Center

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2026-06-23 07:23:12 Re: Fix DROP PROPERTY GRAPH "unsupported object class" error
Previous Message Richard Guo 2026-06-23 07:14:40 Re: [PATCH v1] PL/Perl: Fix NULL deref for forged array