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

From: Zsolt Parragi <zsolt(dot)parragi(at)percona(dot)com>
To: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: [PATCH] Add pg_get_table_ddl() to reconstruct CREATE TABLE statements
Date: 2026-07-02 22:34:00
Message-ID: CAN4CZFP5+hz_Orc1Kz_5v1N0CfWME4aeK1H_=xOLZKdaLW=EyQ@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello!

I can confirm the previous issues fixed, however I also found one more
with unique indexes on partitioned tables:

CREATE SCHEMA s;
CREATE TABLE s.p (id int, region text) PARTITION BY LIST (region);
CREATE TABLE s.p_a PARTITION OF s.p FOR VALUES IN ('a');
CREATE UNIQUE INDEX p_uidx ON s.p (id, region);

SELECT pg_get_table_ddl('s.p', owner => false);
-- CREATE TABLE s.p (id integer, region text) PARTITION BY LIST (region);
-- CREATE UNIQUE INDEX p_uidx ON s.p USING btree (id, region);
-- CREATE TABLE s.p_a PARTITION OF s.p FOR VALUES IN ('a');
-- CREATE UNIQUE INDEX p_a_id_region_idx ON s.p_a USING btree (id,
region); -- fails because index already exists

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Jacob Champion 2026-07-02 22:35:59 Re: First draft of PG 19 release notes
Previous Message Robert Haas 2026-07-02 22:23:43 Re: implement CAST(expr AS type FORMAT 'template')