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 1w3iLh-001Tr7-0S for pgsql-hackers@arkaria.postgresql.org; Fri, 20 Mar 2026 22:29:45 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1w3iLf-008MgK-12 for pgsql-hackers@arkaria.postgresql.org; Fri, 20 Mar 2026 22:29:43 +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 1w3iLe-008MgB-3C for pgsql-hackers@lists.postgresql.org; Fri, 20 Mar 2026 22:29:43 +0000 Received: from mail-yw1-x1136.google.com ([2607:f8b0:4864:20::1136]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1w3iLb-00000000FcL-2P1X for pgsql-hackers@lists.postgresql.org; Fri, 20 Mar 2026 22:29:42 +0000 Received: by mail-yw1-x1136.google.com with SMTP id 00721157ae682-79a46ebe2beso21545457b3.2 for ; Fri, 20 Mar 2026 15:29:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1774045778; cv=none; d=google.com; s=arc-20240605; b=js6vPYxw06D2HoxURsLp8U8rfnOuSE4D0upqbHAYx46+BPV7PU7G/trIzyYDZicdMZ OalYIMAKQjbPHG26atmk7QWylKDSj27nFWnTpD4/zoZOE834PukkOjlq01Dy/n69dy5V cHbSZrdJv1dyWi34on9xVNm8sh7lXr5DIpGn94iZZyVdF/xeLmAvv104Q7Z+TBmJNHiv MOtn7N/X64th8H5IVw3vVuZUlqf96YxkicOL/zg4bLys4VBKEICEfpSaX0EtH/FyTKO3 AQr2013lNd/qAqEOoVzF4oDXZmL569rbeTq+2UoVTRFkxkIOf5333kfKxbmgDSqgxKHD MSIA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:dkim-signature; bh=e4qixhiDZdLPJAvZJgOgOdbOunI4SHCF7FXxFjvKfTc=; fh=hsfGaQs7SMVzeMIBB7liu5j15o2hf3ycXRg8rqdUobQ=; b=imC4Ko/CkrSX6UwClhnXJZ9IGNh16RMXF19HnfUUBN4jJLsg49XbVoTmVLGzFTGrVv KFIhQiQzdNT0sf8kXM5jh7FAcugz2Iqrg/bu6jzF/V3tp7a0FL2ZwQ8h3mrXd8Np/fUu jtkikQGur2J2EbOZZwV/oVPAw9jnd2dy9FxezPfCdVoWyf+TFUjZTk4Tnuz7cLMlz4dy rd57e9Gmz0xBkz8OIsa+85S9lTrvlTYoJ+IH8H+D0OqgHfHEBNrkNI2GxWgzV1X26fav A/r9MdZuW1V7EQGR7UFVqRQhXoRaUt7MKtwbFoiyavWMo89Bl3WPe0u2KeJ1raHM9O/g u0dQ==; darn=lists.postgresql.org ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=percona.com; s=google; t=1774045778; x=1774650578; darn=lists.postgresql.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=e4qixhiDZdLPJAvZJgOgOdbOunI4SHCF7FXxFjvKfTc=; b=dOLDHc+QoRd6rbbjzVETl453Qzn4rlBLkZZcSnKxdU+rLNVOLgnsaEuRnTjUxRh5Fh rT//EUvdc3LraNKIRpMiLQm4f/aRuyw+StYrbPO5W3yuinpZpT7+2K7kLSgIR7CJrAj+ bDy98hlSKQsncAvc6N1tjIC8+Bl56wenQ1/Cc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774045778; x=1774650578; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=e4qixhiDZdLPJAvZJgOgOdbOunI4SHCF7FXxFjvKfTc=; b=jZTfoN4bHGCL4PodttkgW36oj3Bee9POb3D2OdTOijN5m1BbRCrf53zdmYDU0gSnvk XeIFkr2hzJZ83UJalK4XOhHMfV+xvSVPT4bDiIa5FOoBLgT/NBC1IxwWrAj6XZ/KtuEU emZteqLhqL/hXtqXrSBzXo2U70n4UiUH4lx7jRaf0jmLG867rd2TnymhhvVmN+csNbeA Z9XGxXth0rEzdLdUSOcimkLmGfEw8nRgLir+NNllLYiYA8Z38O/Y4vHsGJ2mgdy0Tjkp 4GFebcHunVko8Z0uZHURpjbIVnzKokLk8Lh4tYcXfanRaDV/E5iubKedl64AAGBttGsy X3gQ== X-Forwarded-Encrypted: i=1; AJvYcCUjbkACS/2yuIQgy0JgvV6t+VwU++Apulnup7gSXzptajNqT5oWgCHU4yHuDaP0bogFJ14ToYOMykuukEP+@lists.postgresql.org X-Gm-Message-State: AOJu0YxVKeyOK07saO8RV9rKivFPK/qfQv7/7g6b8SQww4sl4ltx/f2e RlkX2e8KHppURDw5Ihc6mudc7OzZ4rjQy66+Lngwebje3rmxtlKgGGJ0KrCt5mmk0Iee0yGrNY1 KLEwwHuLmVRQUDFVQNuxNld/Km0DnmrrFlP6h8g6FKL3yBJo+ptHi8F5hLF+OmoTLLHcavW6weH KeHPdFT465wd54pIq+nRyF7KDKJ5Z0mI/jHmrQzjbafDHMCpdEueL4bGuOBw3kKcuVx3mkWZgWW Aw8gGzuRudSZt3twrSysEbb1u6nhuZFe4/DgH8FdVlIhmvk4dRXF18zVmnMVjnXDYA= X-Gm-Gg: ATEYQzxn5ISaC1v+61C61lAa+W3wIvCAERsLgB0pdqHtaF1itVG9k0/1BUnk0AdtM7r D5DkFvcJjMjlIabDmWnOTwo0eOWPFRt/VgdnGnm/IT07hzpqEUddL+81ZLn1ABNrOeaYN0JXSsr pbbQW89585Y05jpveZ4Mwk5UPgwjphhGo0FNsPp2TiUnD+vqiSX9oJMv68cMdM62+FTHlF953Pi 3Ds4louJYvQerfK1bGH+K783IV5tBJDBF0z4CaUn8TWPCd81tUXoHPtHIwWWkevStBnhh4SWmNG nxOnxMMf7xfByorK/bMAY4Wrc7XxuAQrXY4BCIubeO1FfDI5CIct1hOwxtXr0bSNr4Bz X-Received: by 2002:a05:690c:e72c:b0:798:5cdd:f1c9 with SMTP id 00721157ae682-79a90aa0ee0mr45023077b3.12.1774045778086; Fri, 20 Mar 2026 15:29:38 -0700 (PDT) MIME-Version: 1.0 References: <5b21d39b-47fe-4a27-86bd-0cc6b924c8f0@app.fastmail.com> In-Reply-To: <5b21d39b-47fe-4a27-86bd-0cc6b924c8f0@app.fastmail.com> From: Zsolt Parragi Date: Fri, 20 Mar 2026 22:29:29 +0000 X-Gm-Features: AaiRm52ZqYE76h9dc6bs5MTZwKamFtEjNsR5cIol-ptteVdopoyhSska6uh157U Message-ID: Subject: Re: pg_get__*_ddl consolidation To: Euler Taveira Cc: Andrew Dunstan , PostgreSQL Hackers Content-Type: text/plain; charset="UTF-8" X-CLOUD-SEC-AV-Sent: true X-CLOUD-SEC-AV-Info: percona,google_mail,monitor X-Gm-Spam: 0 X-Gm-Phishy: 0 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk > I couldn't reproduce the failure. The non-fixed DateStyle is by design. It > mimics pg_dumpall. Sorry, I made a mistake while only copying the relevant parts of the test case here. This is the correct test case: SET DateStyle TO 'SQL, DMY'; -- change from default MDY to DMY CREATE ROLE regress_datestyle_test VALID UNTIL '2030-12-31 23:59:59+00'; SELECT * FROM pg_get_role_ddl('regress_datestyle_test'); DROP ROLE regress_datestyle_test; SET DateStyle TO 'SQL, MDY'; -- go back to default, or open a new connection to use the generated command -- try to run statement generated by pg_get_role_ddl I'm not saying that this is necessarily wrong, but perhaps it's worth mentioning somewhere? > Since I don't know if you will use the testrole role to create testdb > database or even if the testrole exists in the cluster, it shouldn't return the > ALTER DATABASE testdb SET work_mem TO '512MB' (because that property belongs to > testrole role). Sorry, I wasn't specific previously, it returns the role specific role, without the role specific condition: CREATE DATABASE testdb; CREATE ROLE testrole; ALTER DATABASE testdb SET work_mem TO '256MB'; ALTER ROLE testrole IN DATABASE testdb SET work_mem TO '512MB'; SELECT pg_get_database_ddl('testdb'); pg_get_database_ddl ------------------------------------------------------------------------------------------------------------------- CREATE DATABASE testdb WITH TEMPLATE = template0 ENCODING = 'UTF8' LOCALE_PROVIDER = libc LOCALE = 'en_US.UTF-8'; ALTER DATABASE testdb OWNER = dutow; ALTER DATABASE testdb SET work_mem TO '256MB'; ALTER DATABASE testdb SET work_mem TO '512MB'; > one way is to > compare the output with pg_dump(all). Another point is that these functions can > be used by a dump tool.) I did my previous testing with this in mind. Both the role specific database options and the role memberships are related: I understand if you say that this is a design decision / limitation. On the other hand if the goal is that users should be able to replicate dump(all) with these functions, then we should have a way to also get that information, either by providing two different outputs, or by specific additional getter functions.