Avoid mix char with bool type in comparisons

From: Ranier Vilela <ranier(dot)vf(at)gmail(dot)com>
To: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Avoid mix char with bool type in comparisons
Date: 2022-10-06 21:06:34
Message-ID: CAEudQApbr_v76BWsPK4oe6+pEfra7QG1PmSRJRVK64C7jrGWjg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

GIN Indexes:

Defines a type char GinTernaryValue with 3 values:
#define GIN_FALSE 0 /* item is not present / does not match */
#define GIN_TRUE 1 /* item is present / matches */
#define GIN_MAYBE 2 /* don't know if item is present / don't know
* if matches */

So, any use of this GinTernaryValue are:

1. if (key->entryRes[j]) be FALSE if GIN_FALSE
2. if (key->entryRes[j]) be TRUE if GIN_TRUE
3. if (key->entryRes[j]) be TRUE if GIN_MAYBE

So gin matchs can fail with GYN_MAYBE or I lost something?

regards,
Ranier Vilela

Attachment Content-Type Size
avoid_mix_bool_with_char_comparator.patch application/octet-stream 2.4 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Zheng Li 2022-10-06 21:30:09 Re: Support logical replication of DDLs
Previous Message Tom Lane 2022-10-06 20:54:53 Re: Reducing the chunk header sizes on all memory context types