Re: libpq async duplicate error results

From: Andres Freund <andres(at)anarazel(dot)de>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr>, Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>, Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: libpq async duplicate error results
Date: 2022-02-17 01:53:08
Message-ID: 20220217015308.mi24cnd4xwa46nbw@alap3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On 2022-02-16 20:28:02 -0500, Tom Lane wrote:
> Andres Freund <andres(at)anarazel(dot)de> writes:
> > On 2022-02-16 18:51:37 -0500, Tom Lane wrote:
> >> + /* Also, do nothing if the argument is OOM_result */
> >> + if (res == unconstify(PGresult *, &OOM_result))
> >> + return;
>
> > Wouldn't it make more sense to make res const, rather than unconstifying
> > &OOM_result?
>
> Uh ... then we'd have to cast away the const to do free().

I was just thinking of

if ((const PGresult *) res == &OOM_result)

It's not important, I just find it stylistically nicer (making a pointer const
from an non-const pointer is safe, the other way round not generally).

- Andres

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2022-02-17 01:56:30 Re: Small and unaffected typo in pg_logical_slot_get_changes_guts()
Previous Message Andres Freund 2022-02-17 01:50:52 Re: O(n) tasks cause lengthy startups and checkpoints