Re: [PATCH] Add pg_get_database_ddl() function to reconstruct CREATE DATABASE statement

From: Akshay Joshi <akshay(dot)joshi(at)enterprisedb(dot)com>
To: Álvaro Herrera <alvherre(at)kurilemu(dot)de>
Cc: Japin Li <japinli(at)hotmail(dot)com>, Euler Taveira <euler(at)eulerto(dot)com>, Amul Sul <sulamul(at)gmail(dot)com>, Andrew Dunstan <andrew(at)dunslane(dot)net>, Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com>, Quan Zongliang <quanzongliang(at)yeah(dot)net>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [PATCH] Add pg_get_database_ddl() function to reconstruct CREATE DATABASE statement
Date: 2026-03-04 12:59:53
Message-ID: CANxoLDcW2iyOq8JJYQXkzXkK6PtQX-z7Hxe=Ri3nQJX6AaPLjw@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Thanks for the review, Japin. I’ve addressed all of your comments. I also
added a check to throw an error if an option appears more than once.

Attached is the *v10 patch*, now ready for further review.

On Wed, Mar 4, 2026 at 3:15 PM Álvaro Herrera <alvherre(at)kurilemu(dot)de> wrote:

> On 2026-Mar-04, Japin Li wrote:
>
> > After playing with this patch, I’m seeing the following output:
> >
> > # select pg_get_database_ddl('postgres'::regdatabase, 'defaults', true,
> 'pretty', true, 'pretty', false);
>
> I think this should throw an error that 'pretty' was contradictorily
> specified twice. (Maybe also an error if an option appears twice,
> period.)
>
> --
> Álvaro Herrera 48°01'N 7°57'E —
> https://www.EnterpriseDB.com/
>

Attachment Content-Type Size
v10-0001-Add-pg_get_database_ddl-function-to-reconstruct-ddl.patch application/octet-stream 33.3 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Eugeny Goryachev 2026-03-04 13:02:51 [PATCH] intarray: prevent crash in _int_matchsel on invalid query_int input
Previous Message Amul Sul 2026-03-04 12:52:00 Re: pg_waldump: support decoding of WAL inside tarfile