Re: factorial function/phase out postfix operators?
Vik Fearing <vik@postgresfriends.org>
From: Vik Fearing <vik@postgresfriends.org>
To: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>,
pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2020-05-18T15:02:34Z
Lists: pgsql-hackers
On 5/18/20 4:42 PM, Peter Eisentraut wrote: > There have been occasional discussions about deprecating or phasing out > postfix operators, to make various things easier in the parser. > > The first step would in any case be to provide alternatives for the > existing postfix operators. There is currently one, namely the numeric > factorial operator "!". A sensible alternative for that would be > providing a function factorial(numeric) -- and that already exists but > is not documented. (Note that the operator is mapped to proname > "numeric_fac". The function "factorial" maps to the same prosrc but is > otherwise independent of the operator.) > > So I suggest that we add that function to the documentation. I think this should be done regardless. > (Some adjacent cleanup work might also be in order. The test cases for > factorial are currently in int4.sql, but all the factorial functionality > was moved to numeric a long time ago.) > > What are the thoughts about then marking the postfix operator deprecated > and eventually removing it? I am greatly in favor of removing postfix operators as soon as possible. -- Vik Fearing
Commits
-
Remove precedence hacks no longer needed without postfix operators.
- 28a61fc6c58f 14.0 landed
-
Allow most keywords to be used as column labels without requiring AS.
- 06a7c3154f5b 14.0 landed
-
Remove support for postfix (right-unary) operators.
- 1ed6b895634c 14.0 landed
-
Remove factorial operators, leaving only the factorial() function.
- 76f412ab3105 14.0 landed
-
Further refine patch for commenting operator implementation functions.
- 908ab8028640 9.1.0 cited