Re: [PATCH] ternary reloption type - Mailing list pgsql-hackers

From Peter Eisentraut
Subject Re: [PATCH] ternary reloption type
Date
Msg-id 3b230dc4-9495-46b6-8634-e04f9833d45e@eisentraut.org
Whole thread
In response to Re: [PATCH] ternary reloption type  (Álvaro Herrera <alvherre@alvh.no-ip.org>)
Responses Re: [PATCH] ternary reloption type
List pgsql-hackers
On 21.01.26 20:23, Álvaro Herrera wrote:
> On 2026-Jan-21, Nikolay Shaplov wrote:
> 
>> On 16.01.2026 18:14, Álvaro Herrera wrote:
>>> I took a quick look at 0001+0002 and I think it's quite reasonable.
>>> Here it is again with some minor fixups.
>> Good. I like ternary -> pg_ternary change. That is reasonable. And
>> postgres.h is better place for it then c.h.
> I further changed TERNARY_TRUE and so on to have a PG_ prefix also; it's
> not impossible that there's userland code somewhere outside Postgres
> that uses those symbol names, so let's avoid a collision.

I don't like that pg_ternary was added to postgres.h.

There are, depending on how you count, a few to many other ternary types 
used throughout the tree, and it's not clear why this one should be the 
standard one now.  At least if so that should have involved some 
discussion and analysis on the other ones.  There are also some 
tradeoffs about how this type should be designed.  This particular one 
uses 0 and 1 for false and true, and -1 for unset.  Others use 0 for 
unset and other values for false and true.  Maybe this choice is useful 
for this particular use, but we shouldn't impose it on everyone.

Independent of that, I don't understand why this was put into postgres.h 
instead of c.h.  It's not particular to backend code, as far as I can tell.

I think it would be better to rename this to something like 
relopt_ternary and move it to access/reloptions.h.

If we want to consolidate all ternary types, that might be useful, but 
it should be an explicit discussion.





pgsql-hackers by date:

Previous
From: Bertrand Drouvot
Date:
Subject: Re: basebackup: do not verify checksums on pages written before enabling checksums
Next
From: Amit Langote
Date:
Subject: Re: Re-read conindid under the referenced table's lock in the RI fast path