2016-01-22 01:47:15 +01:00
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
*
|
2019-12-27 00:09:00 +01:00
|
|
|
* amvalidate.h
|
2020-08-01 23:12:47 +02:00
|
|
|
* Support routines for index access methods' amvalidate and
|
|
|
|
* amadjustmembers functions.
|
2016-01-22 01:47:15 +01:00
|
|
|
*
|
2021-01-02 19:06:25 +01:00
|
|
|
* Copyright (c) 2016-2021, PostgreSQL Global Development Group
|
2016-01-22 01:47:15 +01:00
|
|
|
*
|
2019-12-27 00:09:00 +01:00
|
|
|
* src/include/access/amvalidate.h
|
2016-01-22 01:47:15 +01:00
|
|
|
*
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
2019-12-27 00:09:00 +01:00
|
|
|
#ifndef AMVALIDATE_H
|
|
|
|
#define AMVALIDATE_H
|
2016-01-22 01:47:15 +01:00
|
|
|
|
|
|
|
#include "utils/catcache.h"
|
|
|
|
|
|
|
|
|
|
|
|
/* Struct returned (in a list) by identify_opfamily_groups() */
|
|
|
|
typedef struct OpFamilyOpFuncGroup
|
|
|
|
{
|
|
|
|
Oid lefttype; /* amoplefttype/amproclefttype */
|
|
|
|
Oid righttype; /* amoprighttype/amprocrighttype */
|
|
|
|
uint64 operatorset; /* bitmask of operators with these types */
|
|
|
|
uint64 functionset; /* bitmask of support funcs with these types */
|
|
|
|
} OpFamilyOpFuncGroup;
|
|
|
|
|
|
|
|
|
2019-12-27 00:09:00 +01:00
|
|
|
/* Functions in access/index/amvalidate.c */
|
2016-01-22 01:47:15 +01:00
|
|
|
extern List *identify_opfamily_groups(CatCList *oprlist, CatCList *proclist);
|
|
|
|
extern bool check_amproc_signature(Oid funcid, Oid restype, bool exact,
|
|
|
|
int minargs, int maxargs,...);
|
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
2020-03-30 18:17:11 +02:00
|
|
|
extern bool check_amoptsproc_signature(Oid funcid);
|
2016-01-22 01:47:15 +01:00
|
|
|
extern bool check_amop_signature(Oid opno, Oid restype,
|
|
|
|
Oid lefttype, Oid righttype);
|
2020-08-01 23:12:47 +02:00
|
|
|
extern Oid opclass_for_family_datatype(Oid amoid, Oid opfamilyoid,
|
|
|
|
Oid datatypeoid);
|
2016-01-22 01:47:15 +01:00
|
|
|
extern bool opfamily_can_sort_type(Oid opfamilyoid, Oid datatypeoid);
|
|
|
|
|
2019-12-27 00:09:00 +01:00
|
|
|
#endif /* AMVALIDATE_H */
|