Remove support for postfix (right-unary) operators

Enterprise / PostgreSQL - Tom Lane [sss.pgh.pa.us] - 17 September 2020 23:38 UTC

This feature has been a thorn in our sides for a long time, causing many grammatical ambiguity problems. It doesn't seem worth the pain to continue to support it, so remove it.

There are some follow-on improvements we can make in the grammar, but this commit only removes the bare minimum number of productions, plus assorted backend support code.

Note that pg_dump and psql continue to have full support, since they may be used against older servers. However, pg_dump warns about postfix operators. There is also a check in pg_upgrade.

Documentation-wise, I (tgl) largely removed the "left unary" terminology in favor of saying "prefix operator", which is a more standard and IMO less confusing term.

I included a catversion bump, although no initial catalog data changes here, to mark the boundary at which oprkind = 'r' stopped being valid in pg_operator.

Mark Dilger, based on work by myself and Robert Haas; review by John Naylor

Discussion: https://postgr.es/m/38ca86db-42ab-9b48-2902-337a0d6b8311@2ndquadrant.com

1ed6b89563 Remove support for postfix (right-unary) operators.
contrib/postgres_fdw/deparse.c | 19 ++--
doc/src/sgml/catalogs.sgml | 8 +-
doc/src/sgml/ref/alter_extension.sgml | 2 +-
doc/src/sgml/ref/alter_operator.sgml | 9 +-
doc/src/sgml/ref/alter_opfamily.sgml | 2 +-
doc/src/sgml/ref/comment.sgml | 2 +-
doc/src/sgml/ref/create_opclass.sgml | 2 +-
doc/src/sgml/ref/create_operator.sgml | 22 +----
doc/src/sgml/ref/drop_operator.sgml | 16 +---
doc/src/sgml/syntax.sgml | 5 +-
doc/src/sgml/typeconv.sgml | 6 +-
doc/src/sgml/xoper.sgml | 12 +--
src/backend/catalog/namespace.c | 7 +-
src/backend/catalog/pg_operator.c | 4 +-
src/backend/commands/operatorcmds.c | 14 ++-
src/backend/nodes/print.c | 1 -
src/backend/parser/gram.y | 13 +--
src/backend/parser/parse_expr.c | 38 ++------
src/backend/parser/parse_oper.c | 128 +++++---------------------
src/backend/utils/adt/ruleutils.c | 39 ++------
src/bin/pg_dump/pg_dump.c | 8 +-
src/bin/pg_upgrade/check.c | 106 +++++++++++++++++++++
src/bin/psql/describe.c | 4 +
src/include/catalog/catversion.h | 2 +-
src/include/catalog/pg_operator.h | 6 +-
src/include/parser/parse_oper.h | 2 -
src/test/regress/expected/create_operator.out | 50 ++++++----
src/test/regress/expected/opr_sanity.out | 17 +---
src/test/regress/sql/create_operator.sql | 36 ++++----
src/test/regress/sql/opr_sanity.sql | 14 +--
src/tutorial/complex.source | 2 +-
src/tutorial/syscat.source | 24 +----
32 files changed, 280 insertions(+), 340 deletions(-)

Upstream: git.postgresql.org


  • Share