Re: logicalrep_message_type throws an error

From: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
To: Ashutosh Bapat <ashutosh(dot)bapat(dot)oss(at)gmail(dot)com>
Cc: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>, Euler Taveira <euler(at)eulerto(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: logicalrep_message_type throws an error
Date: 2023-07-17 14:24:52
Message-ID: 20230717142452.74yml7mfqkypfixp@alvherre.pgsql
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2023-Jul-17, Ashutosh Bapat wrote:

> Prologue of psprintf() says
>
> * Errors are not returned to the caller, but are reported via elog(ERROR)
> * in the backend, or printf-to-stderr-and-exit() in frontend builds.
> * One should therefore think twice about using this in libpq.
>
> If an error occurs in psprintf(), it will throw an error which will
> override the original error. I think we should avoid any stuff that
> throws further errors.

Ooh, yeah, this is an excellent point. I agree it would be better to
avoid psprintf() here and anything that adds more failure modes. Let's
just do the thing in the original patch you submitted, to ensure all
these strings are compile-time constants; that's likely the most robust.

--
Álvaro Herrera PostgreSQL Developer — https://www.EnterpriseDB.com/
"Pensar que el espectro que vemos es ilusorio no lo despoja de espanto,
sólo le suma el nuevo terror de la locura" (Perelandra, C.S. Lewis)

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Stéphane Tachoires 2023-07-17 14:26:14 Re: [PATCH] Automatic HASH and LIST partition creation
Previous Message Aleksander Alekseev 2023-07-17 14:11:46 Re: Getting rid of OverrideSearhPath in namespace.c