Re: Reject invalid databases in pg_get_database_ddl() - Mailing list pgsql-hackers

From Amit Langote
Subject Re: Reject invalid databases in pg_get_database_ddl()
Date
Msg-id CA+HiwqGf_eQNK_bqJzL7YZvXKhpCWsbxxa6pwYVAhQLcPS0rAQ@mail.gmail.com
Whole thread
In response to Re: Reject invalid databases in pg_get_database_ddl()  (Hu Xunqi <huxunqi.08@gmail.com>)
Responses Re: Reject invalid databases in pg_get_database_ddl()
List pgsql-hackers
Hi,

On Fri, Apr 17, 2026 at 11:49 AM Hu Xunqi <huxunqi.08@gmail.com> wrote:
> On Fri, Apr 17, 2026 at 10:16 AM Amit Langote <amitlangote09@gmail.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
shouldnot 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.

--
Thanks, Amit Langote

Attachment

pgsql-hackers by date:

Previous
From: jian he
Date:
Subject: Re: DELETE/UPDATE FOR PORTION OF with rule system is not working
Next
From: Chao Li
Date:
Subject: repack: fix a bug to reject deferrable primary key fallback for concurrent mode