Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vlyqJ-005wtP-1h for pgsql-hackers@arkaria.postgresql.org; Sat, 31 Jan 2026 00:28:03 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vlyqH-006kiI-23 for pgsql-hackers@arkaria.postgresql.org; Sat, 31 Jan 2026 00:28:02 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vlyqH-006ki7-0e for pgsql-hackers@lists.postgresql.org; Sat, 31 Jan 2026 00:28:02 +0000 Received: from mail-dl1-x1230.google.com ([2607:f8b0:4864:20::1230]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1vlyqF-00000000HAW-2IJT for pgsql-hackers@postgresql.org; Sat, 31 Jan 2026 00:28:01 +0000 Received: by mail-dl1-x1230.google.com with SMTP id a92af1059eb24-1233bb90317so3091413c88.1 for ; Fri, 30 Jan 2026 16:27:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1769819277; x=1770424077; darn=postgresql.org; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to; bh=n2eLMWcm3W18bM1Vx7Zce/Gjy5TkBoZjIWp6RBUChpQ=; b=TSmYHrRN63NUWoqcuXKzJq10qVkfOpc7uZWx92MydLvrG/9Gp++3NfM0+w1k77UErJ AiumFKeurQaektGt6aiwru0lBtVH6GLhuVd3PPuEvLTB64YXyM1h2mWH4q2es2IxnIJf znOeAjcOCsnfIQwXsbbp/4QZv7K0b5bpqp/o3Cbmxb9p/Z5omwsqmVlGr5Z8AxHJu9lH +dFzsRPwJnibj/5dSTmdKahgqFm1UXSh0yQynZc4jiGeXQ8nCTWgSrbtoZCGBELuSMCR kQ9A2oL4WvbotrHFiiCqFMKVn/zN2M0GtP3WiIdD5tV2JnMEVKRZrQ4cev2lJTsUImRF pN7Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769819277; x=1770424077; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=n2eLMWcm3W18bM1Vx7Zce/Gjy5TkBoZjIWp6RBUChpQ=; b=JVumOA1E07Wo+qQ9aVkV4eXq1GkL56FHDSEhunAI7EVLwnWee1k12FrakJ7L+t1EZV Cof3v9DmTdZmLQ9/S9TaPZZl2Ieng7ChbUVI6tTC9SZpD/XWQ++akdtc6fUDi6Lk4v4D Cc0YYlnIP1luvaLHqO4ZnbuQM7dNOPpDyvqvYXcZN/m05iHTF2ruwCYeD2YMUnXzOA3e nryE9WJVHVAGB8CnnurokoGrBXciifE5A7+CXiewVjFBsW9d4MVxfe89MLVThb9jSXwb R76L4GTgXhVhs8suJZiEyhGOn6WyxKh0MlmBFTDMbPeTmPfV0eNIXTwphCMLe6fPZ1mc ZCiQ== X-Forwarded-Encrypted: i=1; AJvYcCVbzxB5rvprKVTvS3mQeKSK4o9snvTF+zfsXMB2z3U2AohRBrOiTQX58gvjQUzgtaZLyh0+WmjrxE6i2WU8@postgresql.org X-Gm-Message-State: AOJu0Yx1XUbyLxGoo7EtFyuFct5LrynrC69/jFK1bACQqyA5H/JrYf8F F5nsYt0CUIeNR/2qmuk3N6geNBAIhJLq/etMxm+EFSwJFisdxnbzJCzx X-Gm-Gg: AZuq6aKaeAISfFHMyY2oCu39I2JHTFdgAEpBbWQaRSg04JIFS+OTPJraj12NN21hNlU eRVOr/H171GbS4I9DHZ1QWYLxPMPGPeFqL3UYZiHthNXS10rWiEGTFIIcGLPQPr0AIJYJu0BPJA Wne2N/coe6RfEYoxPX2TdKl/5/l4F3IbuATD+EoyVyfXWLMGNfhMqz0ZghZpSw74sZymUnNBlup uxbkxH4TKAGfr7RaLaOE+3OtUbt6GwkbVfO5Z92NkOojl4y+WWm7CnnWMXPYynP7KxZ8BQRFWbE dJiZJ5/jb++YTFVphaz/Z2KOJdiSuBngRjaugse1gJE4B1+3asbPz4sv9gNmr0DkYj8SsAWwZSC MNXxYzTeE3vM7SnSLNqGTgcO+6c8WDLgdhtUTXxd6ISQLnTVAHZv4XbxtCVUucx1epF8VlBuuoX kk/dvhKte0fW0hP7TH0jJdMJhfKhdQEg== X-Received: by 2002:a05:7022:220d:b0:123:331f:978f with SMTP id a92af1059eb24-124b101ee64mr3598492c88.7.1769819277028; Fri, 30 Jan 2026 16:27:57 -0800 (PST) Received: from o (71-34-92-171.ptld.qwest.net. [71.34.92.171]) by smtp.gmail.com with ESMTPSA id a92af1059eb24-124a9debe5dsm13481967c88.11.2026.01.30.16.27.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 30 Jan 2026 16:27:56 -0800 (PST) Date: Fri, 30 Jan 2026 16:27:53 -0800 From: Mark Wong To: Akshay Joshi Cc: Andrew Dunstan , Euler Taveira , =?iso-8859-1?Q?=C1lvaro?= Herrera , Chao Li , japin , Quan Zongliang , pgsql-hackers Subject: Re: [PATCH] Add pg_get_database_ddl() function to reconstruct CREATE DATABASE statement Message-ID: References: <202511191045.tckydhpoxumx@alvherre.pgsql> <4e60bcae-8222-4e1f-8e5b-d73b59c93304@app.fastmail.com> <4c695e76-5ab7-449f-8060-76518dd41468@app.fastmail.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="FQlEwItJx/kRQFpe" Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --FQlEwItJx/kRQFpe Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit 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 EDB https://enterprisedb.com --FQlEwItJx/kRQFpe Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0003-doc-suggestions.patch" 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} pg_get_database_ddl - pg_get_database_ddl - ( database_id regdatabase - , VARIADIC ddl_options - text[] ) + pg_get_database_ddl ( name , VARIADIC options text[] ) + text + + + + pg_get_database_ddl + + pg_get_database_ddl ( oid , VARIADIC options text[] ) text Reconstructs the CREATE DATABASE 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 - pretty, owner=no/false/0, - tablespace=no/false/0, and defaults - Or defaults=yes. + 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. @@ -3895,8 +3896,8 @@ acl | {postgres=arwdDxtm/postgres,foo=r/postgres} - The ddl_options for pg_get_database_ddl - provide fine-grained control over the generated SQL: + The options for these object DDL functions provide + fine-grained control over the generated SQL: 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'; --FQlEwItJx/kRQFpe--