Re: Use the enum value CRS_EXPORT_SNAPSHOT instead of "0"

Поиск
Список
Период
Сортировка
От Peter Smith
Тема Re: Use the enum value CRS_EXPORT_SNAPSHOT instead of "0"
Дата
Msg-id CAHut+PubXmw8P-XLj0D0C99hScohHZ5JcnwuBjQ7qWGBUe5yCg@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Use the enum value CRS_EXPORT_SNAPSHOT instead of "0"  (Masahiko Sawada <sawada.mshk@gmail.com>)
Список pgsql-hackers
On Fri, Jun 16, 2023 at 6:17 PM Masahiko Sawada <sawada.mshk@gmail.com> wrote:
>
> On Fri, Jun 16, 2023 at 3:10 PM Wei Wang (Fujitsu)
> <wangw.fnst@fujitsu.com> wrote:
> >
> > Hi,
> >
> > In the function WalReceiverMain, when the function walrcv_create_slot is called,
> > the fourth parameter is assigned the value "0" instead of the enum value
> > "CRS_EXPORT_SNAPSHOT". I think it would be better to use the corresponding enum
> > value.
>
> The walreceiver process doesn't use CRS_EXPORT_SNAPSHOT actually,
> right? I think replacing it with CRS_EXPORT_SNAPSHOT would rather
> confuse me
>

Passing some number (0) which has the same value as an enum, while at
the same time not intending it to have the same meaning as that enum
smells strange to me.

If none of the existing enums is meaningful here, then perhaps there
ought to be another enum added  (CRS_UNUSED?) and pass that instead.

~

Alternatively, maybe continue to pass 0, but ensure the existing enums
do not include any value of 0.

e.g.
typedef enum
{
    CRS_EXPORT_SNAPSHOT = 1,
    CRS_NOEXPORT_SNAPSHOT,
    CRS_USE_SNAPSHOT
} CRSSnapshotAction;

------
Kind Regards,
Peter Smith.
Fujitsu Australia



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

Предыдущее
От: Quan Zongliang
Дата:
Сообщение: Incorrect estimation of HashJoin rows resulted from inaccurate small table statistics
Следующее
От: Alvaro Herrera
Дата:
Сообщение: Re: Use the enum value CRS_EXPORT_SNAPSHOT instead of "0"