Re: Small memory fixes for pg_createsubcriber

From: Ranier Vilela <ranier(dot)vf(at)gmail(dot)com>
To: Noah Misch <noah(at)leadboat(dot)com>
Cc: Michael Paquier <michael(at)paquier(dot)xyz>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Andres Freund <andres(at)anarazel(dot)de>, Euler Taveira <euler(at)eulerto(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Small memory fixes for pg_createsubcriber
Date: 2025-04-01 18:53:08
Message-ID: CAEudQAomGvZko5KoMuTGKqqVtW5vYpRW8uo=tsZyZtnU=gJoDA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Em ter., 1 de abr. de 2025 às 15:39, Noah Misch <noah(at)leadboat(dot)com>
escreveu:

> On Thu, Feb 27, 2025 at 10:23:31AM -0300, Ranier Vilela wrote:
> > Em qui., 27 de fev. de 2025 às 02:51, Michael Paquier <
> michael(at)paquier(dot)xyz>
> > escreveu:
> >
> > > On Tue, Feb 25, 2025 at 08:54:31AM -0300, Ranier Vilela wrote:
> > > > @@ -455,7 +455,9 @@ set_locale_and_encoding(void)
> > > > locale->db_locale,
> > > > strlen(locale->db_locale));
> > > > else
> > > > - datlocale_literal = pg_strdup("NULL");
> > > > + datlocale_literal = PQescapeLiteral(conn_new_template1,
> > > > + "NULL",
> > > > + strlen("NULL"));
> > >
> > > Yeah, I've considered that but hardcoding NULL twice felt a bit weird,
> > > as well. Perhaps it's slightly cleaner to use an intermediate
> > > variable given then as an argument of PQescapeLiteral()?
> > >
> > Yeah, I also think it would look good like this.
>
> This became commit 2a083ab "pg_upgrade: Fix inconsistency in memory
> freeing".
> PQescapeLiteral("NULL") is "'NULL'", so this causes pg_database.datlocale
> to
> contain datlocale='NULL'::text instead of datlocale IS NULL.
>
Yeah, thanks for pointing this out.
The patch maintained the previous behavior.
I'll take a look.

best regards,
Ranier Vilela

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2025-04-01 18:54:58 pgsql: aio: Add test_aio module
Previous Message Robert Haas 2025-04-01 18:52:30 Re: RFC: Logging plan of the running query