Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Mark factorial operator, and postfix operators in general, as deprecated.
authorTom Lane <tgl@sss.pgh.pa.us>
Sun, 30 Aug 2020 20:03:19 +0000 (16:03 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Sun, 30 Aug 2020 20:03:19 +0000 (16:03 -0400)
Back-patch key parts of 4c5cf5431 and 6ca547cf7 into stable branches.
I didn't touch pg_description entries here, so it's purely a docs
change; and I didn't fool with any examples either.  The main point
is so that anyone who's wondering if factorial() exists in the stable
branches will be reassured.

Mark Dilger and John Naylor, with some adjustments by me

Discussion: https://postgr.es/m/BE2DF53D-251A-4E26-972F-930E523580E9@enterprisedb.com

doc/src/sgml/func.sgml
doc/src/sgml/ref/create_operator.sgml

index 1c42e39311adb17e23b9fea97524d7945a9b7bec..8b9aab82d5599921eaa6142a99907e6e36a1304c 100644 (file)
 
       <row>
        <entry> <literal>!</literal> </entry>
-       <entry>factorial</entry>
+       <entry>factorial
+        (deprecated, use <function>factorial()</function> instead)</entry>
        <entry><literal>5 !</literal></entry>
        <entry><literal>120</literal></entry>
       </row>
 
       <row>
        <entry> <literal>!!</literal> </entry>
-       <entry>factorial (prefix operator)</entry>
+       <entry>factorial as a prefix operator
+        (deprecated, use <function>factorial()</function> instead)</entry>
        <entry><literal>!! 5</literal></entry>
        <entry><literal>120</literal></entry>
       </row>
        <entry><literal>2.71828182845905</literal></entry>
       </row>
 
+      <row>
+       <entry>
+        <indexterm>
+         <primary>factorial</primary>
+        </indexterm>
+        <literal><function>factorial(<type>bigint</type>)</function></literal>
+       </entry>
+       <entry><type>numeric</type></entry>
+       <entry>factorial</entry>
+       <entry><literal>factorial(5)</literal></entry>
+       <entry><literal>120</literal></entry>
+      </row>
+
       <row>
        <entry>
         <indexterm>
index d5c385c087f5c936410030711c203243ceddca2b..66c34e0072f0df989661c0a107417a7983d56fe7 100644 (file)
@@ -87,11 +87,18 @@ CREATE OPERATOR <replaceable>name</replaceable> (
 
   <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
+   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>
    The <replaceable class="parameter">function_name</replaceable>
    function must have been previously defined using <command>CREATE