pgsql: Extend ALTER OPERATOR to allow setting more optimization attribu

Поиск
Список
Период
Сортировка
От Tom Lane
Тема pgsql: Extend ALTER OPERATOR to allow setting more optimization attribu
Дата
Msg-id E1qtsMq-001WcL-06@gemulon.postgresql.org
обсуждение исходный текст
Список pgsql-committers
Extend ALTER OPERATOR to allow setting more optimization attributes.

Allow the COMMUTATOR, NEGATOR, MERGES, and HASHES attributes to be set
by ALTER OPERATOR.  However, we don't allow COMMUTATOR/NEGATOR to be
changed once set, nor allow the MERGES/HASHES flags to be unset once
set.  Changes like that might invalidate plans already made, and
dealing with the consequences seems like more trouble than it's worth.
The main use-case we foresee for this is to allow addition of missed
properties in extension update scripts, such as extending an existing
operator to support hashing.  So only transitions from not-set to set
states seem very useful.

This patch also causes us to reject some incorrect cases that formerly
resulted in inconsistent catalog state, such as trying to set the
commutator of an operator to be some other operator that already has a
(different) commutator.

While at it, move the InvokeObjectPostCreateHook call for CREATE
OPERATOR to not occur until after we've fixed up commutator or negator
links as needed.  The previous ordering could only be justified by
thinking of the OperatorUpd call as a kind of ALTER OPERATOR step;
but we don't call InvokeObjectPostAlterHook therein.  It seems better
to let the hook see the final state of the operator object.

In the documentation, move the discussion of how to establish
commutator pairs from xoper.sgml to the CREATE OPERATOR ref page.

Tommy Pavlicek, reviewed and editorialized a bit by me

Discussion: https://postgr.es/m/CAEhP-W-vGVzf4udhR5M8Bdv88UYnPrhoSkj3ieR3QNrsGQoqdg@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/2b5154beab794eae6e624c162d497df927ec9d27

Modified Files
--------------
doc/src/sgml/ref/alter_operator.sgml          |  86 ++++++++-
doc/src/sgml/ref/create_operator.sgml         |  66 ++++++-
doc/src/sgml/xoper.sgml                       |  44 -----
src/backend/catalog/pg_operator.c             | 254 +++++++++++++++++---------
src/backend/commands/operatorcmds.c           | 194 +++++++++++++++++---
src/backend/parser/gram.y                     |   2 +
src/backend/parser/parse_oper.c               |  38 ++--
src/include/catalog/pg_operator.h             |  15 ++
src/include/parser/parse_oper.h               |   3 +
src/test/regress/expected/alter_operator.out  | 148 ++++++++++++++-
src/test/regress/expected/create_operator.out |  44 +++++
src/test/regress/sql/alter_operator.sql       | 137 +++++++++++++-
src/test/regress/sql/create_operator.sql      |  43 +++++
13 files changed, 869 insertions(+), 205 deletions(-)


В списке pgsql-committers по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: pgsql: jit: Support opaque pointers in LLVM 16.
Следующее
От: Tom Lane
Дата:
Сообщение: pgsql: Doc: update CREATE OPERATOR's statement about => as an operator.