From: | Mark Dilger <mark(dot)dilger(at)enterprisedb(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | Robert Haas <robertmhaas(at)gmail(dot)com>, John Naylor <john(dot)naylor(at)2ndquadrant(dot)com>, Vik Fearing <vik(at)postgresfriends(dot)org>, Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: factorial function/phase out postfix operators? |
Date: | 2020-08-27 14:14:26 |
Message-ID: | CC4694F0-62FB-4F1D-A26A-AC6E12E68AD8@enterprisedb.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
> On Aug 27, 2020, at 7:04 AM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>
> Robert Haas <robertmhaas(at)gmail(dot)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
Just for historical context, it seems that when you committed 908ab80286401bb20a519fa7dc7a837631f20369 in 2011, you were choosing one operator per underlying proc to be the canonical operator name, and deprecating all other operators based on the same proc. You chose postfix ! as the canonical operator for numeric_fac and deprecated prefix !!, but I think I can infer from that commit that if postfix ! did not exist, prefix !! would have been the canonical operator and would not have been deprecated.
The main reason I did not remove prefix !! in this patch series is that the patch is about removing postfix operator support, and so it seemed off topic. But if there is general agreement to remove prefix !!, I'll put that in the next patch.
—
Mark Dilger
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
From | Date | Subject | |
---|---|---|---|
Next Message | Robert Haas | 2020-08-27 14:19:21 | Re: factorial function/phase out postfix operators? |
Previous Message | Tom Lane | 2020-08-27 14:04:04 | Re: factorial function/phase out postfix operators? |