Re: factorial function/phase out postfix operators?

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: Robert Haas <robertmhaas@gmail.com>
Cc: John Naylor <john.naylor@2ndquadrant.com>, Mark Dilger <mark.dilger@enterprisedb.com>, Vik Fearing <vik@postgresfriends.org>, Peter Eisentraut <peter.eisentraut@2ndquadrant.com>, pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2020-08-27T14:04:04Z
Lists: pgsql-hackers
Robert Haas <robertmhaas@gmail.com> writes:
> Yeah, that looks like a good spot. I think we should also add
> something to the documentation of the factorial operator, mentioning
> that it will be going away. Perhaps we can advise people to write !!3
> instead of 3! for forward-compatibility, or maybe we should instead
> suggest numeric_fac(3).

Well, the !! operator itself has been "deprecated" for a long time:

regression=# \do+ !!
                                             List of operators
   Schema   | Name | Left arg type | Right arg type | Result type |  Function   |        Description        
------------+------+---------------+----------------+-------------+-------------+---------------------------
 pg_catalog | !!   |               | bigint         | numeric     | numeric_fac | deprecated, use ! instead
 pg_catalog | !!   |               | tsquery        | tsquery     | tsquery_not | NOT tsquery
(2 rows)

I'm a bit inclined to kill them both off and standardize on factorial()
(not numeric_fac).

			regards, tom lane



Commits

  1. Remove precedence hacks no longer needed without postfix operators.

  2. Allow most keywords to be used as column labels without requiring AS.

  3. Remove support for postfix (right-unary) operators.

  4. Remove factorial operators, leaving only the factorial() function.

  5. Further refine patch for commenting operator implementation functions.