From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Allow extensions to generate lossy index conditions.
Date: Tue, 12 Feb 2019 02:26:26 +0000
Message-ID: <E1gtNmE-0006tU-Kv@gemulon.postgresql.org> (raw)
Allow extensions to generate lossy index conditions.
For a long time, indxpath.c has had the ability to extract derived (lossy)
index conditions from certain operators such as LIKE. For just as long,
it's been obvious that we really ought to make that capability available
to extensions. This commit finally accomplishes that, by adding another
API for planner support functions that lets them create derived index
conditions for their functions. As proof of concept, the hardwired
"special index operator" code formerly present in indxpath.c is pushed
out to planner support functions attached to LIKE and other relevant
operators.
A weak spot in this design is that an extension needs to know OIDs for
the operators, datatypes, and opfamilies involved in the transformation
it wants to make. The core-code prototypes use hard-wired OID references
but extensions don't have that option for their own operators etc. It's
usually possible to look up the required info, but that may be slow and
inconvenient. However, improving that situation is a separate task.
I want to do some additional refactorization around selfuncs.c, but
that also seems like a separate task.
Discussion: https://postgr.es/m/15193.1548028093@sss.pgh.pa.us
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/74dfe58a5927b22c744b29534e67bfdd203ac028
Modified Files
--------------
doc/src/sgml/xfunc.sgml | 14 +
src/backend/optimizer/path/indxpath.c | 2024 +++++++++++-----------------
src/backend/optimizer/util/clauses.c | 3 +-
src/backend/utils/adt/Makefile | 3 +-
src/backend/utils/adt/like_support.c | 313 +++++
src/backend/utils/adt/network.c | 207 +++
src/include/catalog/catversion.h | 2 +-
src/include/catalog/pg_proc.dat | 98 +-
src/include/nodes/nodes.h | 3 +-
src/include/nodes/pathnodes.h | 9 +-
src/include/nodes/supportnodes.h | 74 +-
src/include/optimizer/optimizer.h | 10 +-
src/test/regress/expected/btree_index.out | 71 +
src/test/regress/expected/create_index.out | 18 +
src/test/regress/expected/inet.out | 55 +
src/test/regress/expected/rowtypes.out | 99 ++
src/test/regress/sql/btree_index.sql | 18 +
src/test/regress/sql/create_index.sql | 4 +
src/test/regress/sql/inet.sql | 10 +
src/test/regress/sql/rowtypes.sql | 27 +
20 files changed, 1771 insertions(+), 1291 deletions(-)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-committers@postgresql.org
Cc: tgl@sss.pgh.pa.us
Subject: Re: pgsql: Allow extensions to generate lossy index conditions.
In-Reply-To: <E1gtNmE-0006tU-Kv@gemulon.postgresql.org>
References: <E1gtNmE-0006tU-Kv@gemulon.postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox