Обсуждение: Use bool with synced field (src/include/replication/slot.h)

Поиск
Список
Период
Сортировка

Use bool with synced field (src/include/replication/slot.h)

От
Ranier Vilela
Дата:
Hi.

IMO in the struct ReplicationSlotPersistentData, the field
*synced* has wrong type declaration.
The intention was *bool* not *char* type.

Since it is only used in Boolean comparison.

trivial patch attached.

best regards,
Ranier Vilela
Вложения

Re: Use bool with synced field (src/include/replication/slot.h)

От
Nathan Bossart
Дата:
On Tue, Sep 02, 2025 at 09:47:49AM -0300, Ranier Vilela wrote:
> IMO in the struct ReplicationSlotPersistentData, the field *synced* has
> wrong type declaration. The intention was *bool* not *char* type.
> 
> Since it is only used in Boolean comparison.

LGTM.  In the original thread, it looks like this was added in v32 [0] and
effectively switched to a bool in v58 [1].

[0] https://postgr.es/m/CAJpy0uC2gYybBcvYCW68wvR-3akWnFbr7x66nZg7XTyjELW9iw%40mail.gmail.com
[1] https://postgr.es/m/OS0PR01MB57169DD55EC8D9D1EDB7A0C2946A2%40OS0PR01MB5716.jpnprd01.prod.outlook.com

-- 
nathan



Re: Use bool with synced field (src/include/replication/slot.h)

От
Nathan Bossart
Дата:
On Tue, Sep 02, 2025 at 11:02:37AM -0500, Nathan Bossart wrote:
> LGTM.  In the original thread, it looks like this was added in v32 [0] and
> effectively switched to a bool in v58 [1].

I was worried that we might need to bump SLOT_VERSION for this, but I see
that as of v18 [0], we require sizeof(bool) == 1.  So I think it can be
applied as-is, which I'm planning to do shortly.

[0] https://postgr.es/c/97525bc5c8

-- 
nathan



Re: Use bool with synced field (src/include/replication/slot.h)

От
Nathan Bossart
Дата:
Committed.

-- 
nathan



Re: Use bool with synced field (src/include/replication/slot.h)

От
Nathan Bossart
Дата:
On Tue, Sep 02, 2025 at 04:54:59PM -0500, Nathan Bossart wrote:
> Committed.

Gah, the commit message lists your name under the Discussion tag, and I
missed adding the link to the archives.  Please forgive the brain fade.

-- 
nathan



Re: Use bool with synced field (src/include/replication/slot.h)

От
Ranier Vilela
Дата:
Em ter., 2 de set. de 2025 às 18:57, Nathan Bossart <nathandbossart@gmail.com> escreveu:
On Tue, Sep 02, 2025 at 04:54:59PM -0500, Nathan Bossart wrote:
> Committed.

Gah, the commit message lists your name under the Discussion tag, and I
missed adding the link to the archives.  Please forgive the brain fade.
Don't worry, thanks for the commit.

best regards,
Ranier Vilela