Re: pgsql: Implement operator class parameters

From: Andres Freund <andres(at)anarazel(dot)de>
To: Alexander Korotkov <akorotkov(at)postgresql(dot)org>
Cc: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: Re: pgsql: Implement operator class parameters
Date: 2020-03-30 18:36:14
Message-ID: 20200330183614.qrfi7zipcqiztpti@alap3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Hi,

On 2020-03-30 16:17:53 +0000, Alexander Korotkov wrote:
> Implement operator class parameters
>
> PostgreSQL provides set of template index access methods, where opclasses have
> much freedom in the semantics of indexing. These index AMs are GiST, GIN,
> SP-GiST and BRIN. There opclasses define representation of keys, operations on
> them and supported search strategies. So, it's natural that opclasses may be
> faced some tradeoffs, which require user-side decision. This commit implements
> opclass parameters allowing users to set some values, which tell opclass how to
> index the particular dataset.
>
> This commit doesn't introduce new storage in system catalog. Instead it uses
> pg_attribute.attoptions, which is used for table column storage options but
> unused for index attributes.
>
> In order to evade changing signature of each opclass support function, we
> implement unified way to pass options to opclass support functions. Options
> are set to fn_expr as the constant bytea expression. It's possible due to the
> fact that opclass support functions are executed outside of expressions, so
> fn_expr is unused for them.
>
> This commit comes with some examples of opclass options usage. We parametrize
> signature length in GiST. That applies to multiple opclasses: tsvector_ops,
> gist__intbig_ops, gist_ltree_ops, gist__ltree_ops, gist_trgm_ops and
> gist_hstore_ops. Also we parametrize maximum number of integer ranges for
> gist__int_ops. However, the main future usage of this feature is expected
> to be json, where users would be able to specify which way to index particular
> json parts.
>
> Catversion is bumped.
>
> Discussion: https://postgr.es/m/d22c3a18-31c7-1879-fc11-4c1ce2f5e5af%40postgrespro.ru
> Author: Nikita Glukhov, revised by me
> Reviwed-by: Nikolay Shaplov, Robert Haas, Tom Lane, Tomas Vondra, Alvaro Herrera

This triggers a few new (harmless) warnings for me:
In file included from /home/andres/src/postgresql/src/include/postgres.h:46,
from /home/andres/src/postgresql/src/backend/access/index/indexam.c:44:
/home/andres/src/postgresql/src/backend/access/index/indexam.c: In function ‘index_getprocid’:
/home/andres/src/postgresql/src/backend/access/index/indexam.c:782:17: warning: comparison is always true due to limited range of data type [-Wtype-limits]
782 | Assert(procnum >= 0 && procnum <= (uint16) nproc);
| ^~
/home/andres/src/postgresql/src/backend/access/index/indexam.c:782:2: note: in expansion of macro ‘Assert’
782 | Assert(procnum >= 0 && procnum <= (uint16) nproc);
| ^~~~~~
/home/andres/src/postgresql/src/backend/access/index/indexam.c: In function ‘index_getprocinfo’:
/home/andres/src/postgresql/src/backend/access/index/indexam.c:818:17: warning: comparison is always true due to limited range of data type [-Wtype-limits]
818 | Assert(procnum >= 0 && procnum <= (uint16) nproc);
| ^~
/home/andres/src/postgresql/src/include/c.h:782:9: note: in definition of macro ‘Assert’
782 | if (!(condition)) \
| ^~~~~~~~~
PostgreSQL installation complete.

Greetings,

Andres Freund

In response to

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Peter Geoghegan 2020-03-30 19:04:18 pgsql: Consistently truncate non-key suffix columns.
Previous Message Andres Freund 2020-03-30 18:10:30 Re: pgsql: Improve handling of parameter differences in physical replicatio