[PATCH] Combine same ternary types in GIN and TSearch

From: Pavel Borisov <pashkin(dot)elfe(at)gmail(dot)com>
To: Postgres hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: [PATCH] Combine same ternary types in GIN and TSearch
Date: 2020-11-13 09:04:41
Message-ID: CALT9ZEHVMrbbnps7Rame2xShnh96Bfk+bfTXR7tVYXOUE1=esw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi, hackers!

For historical reasons, now we have two differently named but similar
ternary data types in TSearch and Gin text-related types. Before v13 there
was also Gin's private TS_execute() version, from which we eventually
shifted to Tsearch's TS_execute().

To make things more even and beautiful I've made a minor refactor to
combine two left ternary types into one.

<gin.h>
typedef char GinTernaryValue
#define GIN_FALSE 0
#define GIN_TRUE 1
#define GIN_MAYBE 2

<ts_utils.h>
typedef enum { TS_NO, TS_YES, TS_MAYBE } TSTernaryValue;

The change is simple and most of it is just the text replacement. The only
thing worth noting is that some code does pointer cast between *bool and
*TernaryValue so the size of them should coincide. (Declaration done in
*char* type because simple enum on most architectures will be of *int*
size). There is no actual change in the code despite the order of header
files inclusion in some modules.

What do you think about this?

--
Best regards,
Pavel Borisov

Postgres Professional: http://postgrespro.com <http://www.postgrespro.com>

Attachment Content-Type Size
v1-0001-Combine-same-types-GinTernaryValue-and-TSTernaryV.patch application/octet-stream 31.3 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Greg Nancarrow 2020-11-13 09:14:20 Re: Parallel INSERT (INTO ... SELECT ...)
Previous Message Amit Kapila 2020-11-13 08:56:12 Re: Parallel copy