1
0
mirror of https://github.com/postgres/postgres.git synced 2025-12-21 05:21:08 +03:00

Remove support for postfix (right-unary) operators.

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
This commit is contained in:
Tom Lane
2020-09-17 19:38:05 -04:00
parent 76f412ab31
commit 1ed6b89563
32 changed files with 279 additions and 339 deletions

View File

@@ -86,20 +86,9 @@ CREATE OPERATOR <replaceable>name</replaceable> (
</para>
<para>
At least one of <literal>LEFTARG</literal> and <literal>RIGHTARG</literal> must be defined. For
binary operators, both must be defined. For right unary
operators, only <literal>LEFTARG</literal> should be defined, while for left
unary operators only <literal>RIGHTARG</literal> should be defined.
</para>
<note>
<para>
Right unary, also called postfix, operators are deprecated and will be
removed in <productname>PostgreSQL</productname> version 14.
</para>
</note>
<para>
For binary operators, both <literal>LEFTARG</literal> and
<literal>RIGHTARG</literal> must be defined. For prefix operators only
<literal>RIGHTARG</literal> should be defined.
The <replaceable class="parameter">function_name</replaceable>
function must have been previously defined using <command>CREATE
FUNCTION</command> and must be defined to accept the correct number
@@ -160,7 +149,7 @@ CREATE OPERATOR <replaceable>name</replaceable> (
<listitem>
<para>
The data type of the operator's left operand, if any.
This option would be omitted for a left-unary operator.
This option would be omitted for a prefix operator.
</para>
</listitem>
</varlistentry>
@@ -169,8 +158,7 @@ CREATE OPERATOR <replaceable>name</replaceable> (
<term><replaceable class="parameter">right_type</replaceable></term>
<listitem>
<para>
The data type of the operator's right operand, if any.
This option would be omitted for a right-unary operator.
The data type of the operator's right operand.
</para>
</listitem>
</varlistentry>