Re: Avoid mix char with bool type in comparisons

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Ranier Vilela <ranier(dot)vf(at)gmail(dot)com>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Avoid mix char with bool type in comparisons
Date: 2022-10-07 17:43:59
Message-ID: 3190937.1665164639@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Ranier Vilela <ranier(dot)vf(at)gmail(dot)com> writes:
> Anyway, it's not *true* that collectMatchesForHeapRow deals
> only "true" and "false", once that key->entryRes is initialized with
> GIN_FALSE not false.

Look: GinTernaryValue is carefully designed so that it is
representation-compatible with bool, including that GIN_FALSE is
identical to false and GIN_TRUE is identical to true. I'm quite
uninterested in debating whether that's a good idea or not.
Moreover, there are a ton of other places besides this one where
the GIN code relies on that equivalence, so we'd have to do a
lot more than what's in this patch if we wanted to decouple that.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Ranier Vilela 2022-10-07 17:44:56 Re: Avoid mix char with bool type in comparisons
Previous Message Tom Lane 2022-10-07 17:37:56 Re: Error-safe user functions