From: | Heikki Linnakangas <hlinnaka(at)iki(dot)fi> |
---|---|
To: | Pavel Borisov <pashkin(dot)elfe(at)gmail(dot)com>, Postgres hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
Subject: | Re: [PATCH] Combine same ternary types in GIN and TSearch |
Date: | 2020-11-13 11:08:44 |
Message-ID: | 8384f00f-3013-9320-3158-6a59389e8640@iki.fi |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On 13/11/2020 11:04, Pavel Borisov wrote:
> 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?
GIN is not just for full-text search, so using TSTernaryValue in
GinScanKeyData is wrong. And it would break existing extensions.
I didn't look much further than that, but I've got a feeling that
combining those is a bad idea. TSTernaryValue is used in text-search
code, even when there is no GIN involved. It's a separate concept, even
though it happens to have the same values.
- Heikki
From | Date | Subject | |
---|---|---|---|
Next Message | Bharath Rupireddy | 2020-11-13 11:21:39 | Re: Multi Inserts in CREATE TABLE AS - revived patch |
Previous Message | Georgios | 2020-11-13 10:47:35 | Re: Supporting = operator in gin/gist_trgm_ops |