Re: factorial function/phase out postfix operators?
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Vik Fearing <vik@postgresfriends.org>
Cc: Robert Haas <robertmhaas@gmail.com>,
Peter Eisentraut <peter.eisentraut@2ndquadrant.com>,
pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2020-05-19T15:32:10Z
Lists: pgsql-hackers
Vik Fearing <vik@postgresfriends.org> writes: > I'm -1 on keeping ! around as a hard-coded postfix operator. Before we go much further on this, we should have some proof that there's actually material benefit to be gained. I spent some time just now trying to relax the AS restriction by ripping out postfix ops, and the results were not too promising. Indeed the postfix-ops problem goes away, but then you find out that SQL's random syntax choices for type names become the stumbling block. An example here is that given SELECT 'foo'::character varying it's not clear if "varying" is supposed to be part of the type name or a column label. It looks to me like we'd have to increase the reserved-ness of VARYING, PRECISION, and about half a dozen currently-unreserved keywords involved in INTERVAL syntax, including such popular column names as "month", "day", and "year". Plus I got conflicts on WITHIN, GROUP, and FILTER from ordered-set aggregate syntax; those are currently unreserved keywords, but they can't be allowed as AS-less column labels. We could possibly minimize the damage by inventing another keyword classification besides the four we have now. Or maybe we should think harder about using more lookahead between the lexer and grammar. But this is going to be a lot more ticklish than I would've hoped, and possibly not cost-free, so we might well end up never pulling the trigger on such a change. So right at the moment I'm agreeing with Stephen's nearby opinion: let's not deprecate these until we've got a patch that gets some concrete benefit from removing them. regards, tom lane
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