Re: libpq async duplicate error results

Поиск
Список
Период
Сортировка
От Andres Freund
Тема Re: libpq async duplicate error results
Дата
Msg-id 20220217015308.mi24cnd4xwa46nbw@alap3.anarazel.de
обсуждение исходный текст
Ответ на Re: libpq async duplicate error results  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: libpq async duplicate error results  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
Hi,

On 2022-02-16 20:28:02 -0500, Tom Lane wrote:
> Andres Freund <andres@anarazel.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



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Andres Freund
Дата:
Сообщение: Re: O(n) tasks cause lengthy startups and checkpoints
Следующее
От: Michael Paquier
Дата:
Сообщение: Re: Small and unaffected typo in pg_logical_slot_get_changes_guts()