Re: Reject invalid databases in pg_get_database_ddl()

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Amit Langote <amitlangote09(at)gmail(dot)com>, Lakshmi N <lakshmin(dot)jhs(at)gmail(dot)com>
Cc: Hu Xunqi <huxunqi(dot)08(at)gmail(dot)com>, Euler Taveira <euler(at)eulerto(dot)com>, "pgsql-hackers(at)lists(dot)postgresql(dot)org" <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Reject invalid databases in pg_get_database_ddl()
Date: 2026-04-17 12:40:41
Message-ID: 4f0d336f-3de6-4671-b7d2-b7d8e3cbf790@dunslane.net
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


On 2026-04-17 Fr 12:22 AM, Amit Langote wrote:
> On Fri, Apr 17, 2026 at 1:21 PM Lakshmi N <lakshmin(dot)jhs(at)gmail(dot)com> wrote:
>> On Thu, Apr 16, 2026 at 8:31 PM Amit Langote <amitlangote09(at)gmail(dot)com> wrote:
>>> On Fri, Apr 17, 2026 at 11:49 AM Hu Xunqi <huxunqi(dot)08(at)gmail(dot)com> wrote:
>>>> On Fri, Apr 17, 2026 at 10:16 AM Amit Langote <amitlangote09(at)gmail(dot)com> wrote:
>>>> + /*
>>>> + * Reject invalid databases: datconnlimit = -2 would be emitted as
>>>> + * CONNECTION LIMIT = -2, which cannot be executed.
>>>> + */
>>>>
>>>> This comment looks a bit too centered on datconnlimit=-2, but the real issue is that an invalid pg_database row should not be deparsed into DDL. So, maybe rephrase like:
>>>>
>>>> /*
>>>> * Reject invalid databases. Deparsing a pg_database row in invalid state
>>>> * can produce SQL that is not executable, such as CONNECTION LIMIT = -2.
>>>> */
>>> I was trying to be precise about datconnlimit = -2 being the thing
>>> that produces invalid SQL. But your version covers that with the "such
>>> as CONNECTION LIMIT = -2" example, and it's closer to the original,
>>> which was on the right track, just needed to be more precise. Let's go
>>> with it.
>> This looks good to me. Thank you for reviewing and making the changes!
> Pushed.
>

Thanks for jumping on this.

cheers

andrew

--
Andrew Dunstan
EDB: https://www.enterprisedb.com

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message cca5507 2026-04-17 12:45:57 Re: [PATCH] Fix hashed ScalarArrayOp semantics for NULL LHS with non-strict comparators
Previous Message Xuneng Zhou 2026-04-17 12:25:35 test: avoid redundant standby catchup in 049_wait_for_lsn