Mathematical Functions and Operators

Started by Marcos Pegoraroover 1 year ago4 messages
#1Marcos Pegoraro
marcos@f10.com.br
1 attachment(s)

Exponentiation, Square root and Cube root operators are not formatted with
<replaceable> tag like others.

https://www.postgresql.org/docs/current/functions-math.html

regards
Marcos

Attachments:

patch.diffapplication/octet-stream; name=patch.diffDownload
diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml
index b24782058f..5f5ba37b1d 100644
--- a/doc/src/sgml/func.sgml
+++ b/doc/src/sgml/func.sgml
@@ -992,12 +992,12 @@ SELECT NOT(ROW(table.*) IS NOT NULL) FROM TABLE; -- detect at least one null in
 
       <row>
        <entry role="func_table_entry"><para role="func_signature">
-        <type>numeric</type> <literal>^</literal> <type>numeric</type>
-        <returnvalue>numeric</returnvalue>
+        <replaceable>numeric</replaceable> <literal>^</literal> <replaceable>numeric</replaceable>
+        <returnvalue><replaceable>numeric</replaceable></returnvalue>
        </para>
        <para role="func_signature">
-        <type>double precision</type> <literal>^</literal> <type>double precision</type>
-        <returnvalue>double precision</returnvalue>
+        <replaceable>double precision</replaceable> <literal>^</literal> <replaceable>double precision</replaceable>
+        <returnvalue><replaceable>double precision</replaceable></returnvalue>
        </para>
        <para>
         Exponentiation
@@ -1022,8 +1022,8 @@ SELECT NOT(ROW(table.*) IS NOT NULL) FROM TABLE; -- detect at least one null in
 
       <row>
        <entry role="func_table_entry"><para role="func_signature">
-        <literal>|/</literal> <type>double precision</type>
-        <returnvalue>double precision</returnvalue>
+        <literal>|/</literal> <replaceable>double precision</replaceable>
+        <returnvalue><replaceable>double precision</replaceable></returnvalue>
        </para>
        <para>
         Square root
@@ -1036,8 +1036,8 @@ SELECT NOT(ROW(table.*) IS NOT NULL) FROM TABLE; -- detect at least one null in
 
       <row>
        <entry role="func_table_entry"><para role="func_signature">
-        <literal>||/</literal> <type>double precision</type>
-        <returnvalue>double precision</returnvalue>
+        <literal>||/</literal> <replaceable>double precision</replaceable>
+        <returnvalue><replaceable>double precision</replaceable></returnvalue>
        </para>
        <para>
         Cube root
#2Marcos Pegoraro
marcos@f10.com.br
In reply to: Marcos Pegoraro (#1)
Re: Mathematical Functions and Operators

Em qua., 9 de out. de 2024 às 16:16, Marcos Pegoraro <marcos@f10.com.br>
escreveu:

Exponentiation, Square root and Cube root operators are not formatted with
<replaceable> tag like others.

Paying more attention, there is no standard on any of those Comparison,
String, Math, Date/Time and so on functions and operators tables. What
format should it be ?
Only datatypes should use <replaceable> ?
Shouldn't function names use <replaceable> too ?

regards
marcos

#3David G. Johnston
david.g.johnston@gmail.com
In reply to: Marcos Pegoraro (#2)
Re: Mathematical Functions and Operators

On Wednesday, October 9, 2024, Marcos Pegoraro <marcos@f10.com.br> wrote:

Shouldn't function names use <replaceable> too ?

Replaceable means the user is expected to substitute an expression in that
location. One cannot specify a function name using an expression.

David J.

#4Marcos Pegoraro
marcos@f10.com.br
In reply to: David G. Johnston (#3)
Re: Mathematical Functions and Operators

Em qua., 9 de out. de 2024 às 18:23, David G. Johnston <
david.g.johnston@gmail.com> escreveu:

Replaceable means the user is expected to substitute an expression in that
location. One cannot specify a function name using an expression.

Sorry, I thought function parameters but said names. So, function params
should have <replaceable> too ?
If you see JSON functions there are functions that their params have
<replaceable> tag

json_array ( [ *query_expression* ] [ RETURNING *data_type* [ FORMAT
JSON [ ENCODING
UTF8 ] ] ])
json_scalar ( *expression* )
json_serialize ( *expression* [ FORMAT JSON [ ENCODING UTF8 ] ] [ RETURNING
*data_type* [ FORMAT JSON [ ENCODING UTF8 ] ] ] )

they are fine, but a lot of others don't

to_json ( anyelement ) → json
json_object ( text[] ) → json

regars
Marcos