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

From: Marcos Pegoraro <marcos(at)f10(dot)com(dot)br>
To: Akshay Joshi <akshay(dot)joshi(at)enterprisedb(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [PATCH] Add pg_get_table_ddl() to reconstruct CREATE TABLE statements
Date: 2026-06-08 19:11:05
Message-ID: CAB-JLwZXk95KnOs57fe2d7zaOYf5aAAY2kVF5U7cXYXJmZ9jBg@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Em seg., 8 de jun. de 2026 às 08:30, Akshay Joshi <
akshay(dot)joshi(at)enterprisedb(dot)com> escreveu:

> Hi Hackers,
>
> Attached is the v2 patch, which fixes the Meson build failure, and the
> rebased patch.
>

Would be good to have an option "schema-qualified" boolean, because
sometimes I don't want a schema-qualified result.
Suppose you are duplicating a schema, the way your did you cannot do
something like this to have a complete script to generate a new schema

select 'create schema new_schema;' union all
select 'set search_path to new_schema, public;' union all
select string_agg(pg_get_table_ddl(oid),',') from pg_class where
relnamespace::regnamespace::text = 'old_schema' and relkind = 'r';

regards
Marcos

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Ayush Tiwari 2026-06-08 19:14:21 Re: Remove the refint contrib module (for v20)
Previous Message Tom Lane 2026-06-08 18:46:12 Re: Adjust pg_stat_get_lock() prorows to match lock types