public inbox for [email protected]
help / color / mirror / Atom feedFrom: Mark Wong <[email protected]>
To: Akshay Joshi <[email protected]>
Cc: Andrew Dunstan <[email protected]>
Cc: Euler Taveira <[email protected]>
Cc: Álvaro Herrera <[email protected]>
Cc: Chao Li <[email protected]>
Cc: japin <[email protected]>
Cc: Quan Zongliang <[email protected]>
Cc: pgsql-hackers <[email protected]>
Subject: Re: [PATCH] Add pg_get_database_ddl() function to reconstruct CREATE DATABASE statement
Date: Fri, 30 Jan 2026 16:27:53 -0800
Message-ID: <aX1MiWtawMipiau6@o> (raw)
In-Reply-To: <CANxoLDd73eDHykBquqqButBp73mHudyM-3iQnYp6FmPnetZb-g@mail.gmail.com>
References: <[email protected]>
<CANxoLDeEzSvC8hy7oF=qZZGVD---MDwxesdoQnAQMuJQGOSaJw@mail.gmail.com>
<[email protected]>
<CANxoLDeAv5M-HcVnwN6q3RNaBeXRfkR7_3LAvZ=pfLqc8=N8vw@mail.gmail.com>
<[email protected]>
<[email protected]>
<CANxoLDcF=eqXB59WcTqCwrp6u5Qw0bUjVSTbRApquSvsYLcPWQ@mail.gmail.com>
<CANxoLDd2iMLGc1WsNFywB_jZmCYJON-6g1awwsC_S1Q-PRJDVw@mail.gmail.com>
<CANxoLDfvx0t-wMNbtbtnRwcV9wNW58PY3vOSKSGukhGgw5-e1A@mail.gmail.com>
<CANxoLDd73eDHykBquqqButBp73mHudyM-3iQnYp6FmPnetZb-g@mail.gmail.com>
On Wed, Jan 21, 2026 at 03:01:44PM +0530, Akshay Joshi wrote:
> In my previous email, I included two different patches (for two separate
> approaches) from different branches. As a result, CommitFest is indicating
> that a rebase is required.
>
> Apologies for the inconvenience, I’m still getting familiar with the
> process.
>
> Attached are the patches, layered one on top of the other, representing two
> approaches:
>
> - *Double Dash*:
> v8-0001-Add-pg_get_database_ddl-function-to-reconstruct-double-dash.patch
> - *DefElem (Key-Value)*:
> v8-0002-Add-pg_get_database_ddl-function-to-reconstruct-DefElem.patch
>
> I am now submitting the *v8 patches*, which are ready for review. Please
> let me know which approach you find more suitable and preferable.
I have some documentation style suggestions that I've also attached as a patch:
* Update the pg_get_database_ddl() definitions in the func-info table to list
the multiple database way to reference a database, similar to
pg_database_size()
* Shorten the argument description for OID and name, again similar to
pg_database_size()'s style
* Shorten ddl_options argument description to simply options, to match the
style of how other functions in the docs describe optional parameters
* Remove the redundant explanation of the optional parameters in the individual
function's description, and instead refer the reader to the explanation
following the table
* Some word choice and phrasing changes in the pg_get_database_ddl function
description to be grammatically closer to something like
pg_restore_relation_stats()
I hope that is helpful...
Regards,
Mark
--
Mark Wong <[email protected]>
EDB https://enterprisedb.com
Attachments:
[text/x-diff] v8-0003-doc-suggestions.patch (3.0K, 2-v8-0003-doc-suggestions.patch)
download | inline diff:
diff --git a/doc/src/sgml/func/func-info.sgml b/doc/src/sgml/func/func-info.sgml
index 218578c318f..4fc74ca29a1 100644
--- a/doc/src/sgml/func/func-info.sgml
+++ b/doc/src/sgml/func/func-info.sgml
@@ -3874,20 +3874,21 @@ acl | {postgres=arwdDxtm/postgres,foo=r/postgres}
<indexterm>
<primary>pg_get_database_ddl</primary>
</indexterm>
- <function>pg_get_database_ddl</function>
- ( <parameter>database_id</parameter> <type>regdatabase</type>
- <optional>, <literal>VARIADIC</literal> <parameter>ddl_options</parameter>
- <type>text[]</type> </optional> )
+ <function>pg_get_database_ddl</function> ( <type>name</type> <optional>, <literal>VARIADIC</literal> <parameter>options</parameter> <type>text[]</type> </optional> )
+ <returnvalue>text</returnvalue>
+ </para>
+ <para role="func_signature">
+ <indexterm>
+ <primary>pg_get_database_ddl</primary>
+ </indexterm>
+ <function>pg_get_database_ddl</function> ( <type>oid</type> <optional>, <literal>VARIADIC</literal> <parameter>options</parameter> <type>text[]</type> </optional> )
<returnvalue>text</returnvalue>
</para>
<para>
Reconstructs the <command>CREATE DATABASE</command> statement from the
- system catalogs for a specified database. The first argument is the OID or
- name of the database. The optional variadic argument is an array of text
- flags to control the output. Supported options include
- <literal>pretty</literal>, <literal>owner=no/false/0</literal>,
- <literal>tablespace=no/false/0</literal>, and <literal>defaults</literal>
- Or <literal>defaults=yes</literal>.
+ system catalogs for a specified database by name or OID. The optional
+ variadic argument is an array of arguments to control the output
+ formatting and content. Supported arguments explained below.
</para></entry>
</row>
</tbody>
@@ -3895,8 +3896,8 @@ acl | {postgres=arwdDxtm/postgres,foo=r/postgres}
</table>
<para>
- The <parameter>ddl_options</parameter> for <function>pg_get_database_ddl</function>
- provide fine-grained control over the generated SQL:
+ The <parameter>options</parameter> for these object DDL functions provide
+ fine-grained control over the generated SQL:
<itemizedlist>
<listitem>
<para>
diff --git a/src/backend/catalog/system_functions.sql b/src/backend/catalog/system_functions.sql
index 16c0d52479a..69a098561e7 100644
--- a/src/backend/catalog/system_functions.sql
+++ b/src/backend/catalog/system_functions.sql
@@ -658,7 +658,7 @@ STRICT VOLATILE PARALLEL UNSAFE
AS 'pg_replication_origin_session_setup';
CREATE OR REPLACE FUNCTION
- pg_get_database_ddl(database_id regdatabase, VARIADIC ddl_options text[] DEFAULT '{}')
+ pg_get_database_ddl(database_id regdatabase, VARIADIC options text[] DEFAULT '{}')
RETURNS text
LANGUAGE internal
AS 'pg_get_database_ddl';
view thread (6+ messages)
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected]
Subject: Re: [PATCH] Add pg_get_database_ddl() function to reconstruct CREATE DATABASE statement
In-Reply-To: <aX1MiWtawMipiau6@o>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox