aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2021-07-21 18:03:33 -0400
committerTom Lane <tgl@sss.pgh.pa.us>2021-07-21 18:04:15 -0400
commit7fa1e1ef741964eeb50f33d7c72622658bb7e5f4 (patch)
tree3c7240c7951905506c3b81e9208d5d982d27e45b
parentaaec237b1a2f368ed2a8794c4f48b3656750eabc (diff)
downloadpostgresql-7fa1e1ef741964eeb50f33d7c72622658bb7e5f4.tar.gz
postgresql-7fa1e1ef741964eeb50f33d7c72622658bb7e5f4.zip
Doc: improve documentation about exponentiation operator.
Now that we're not having to wedge this into the straitjacket of the old operator table format, we can add another example to clarify the point about left-to-right associativity. Per suggestion from mdione at grulic.org.ar. https://postgr.es/m/162661954599.693.13700316547731859171@wrigleys.postgresql.org
-rw-r--r--doc/src/sgml/func.sgml11
1 files changed, 9 insertions, 2 deletions
diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml
index e833be8f96b..f62c33e5c71 100644
--- a/doc/src/sgml/func.sgml
+++ b/doc/src/sgml/func.sgml
@@ -988,16 +988,23 @@ repeat('Pg', 4) <returnvalue>PgPgPgPg</returnvalue>
<returnvalue>double precision</returnvalue>
</para>
<para>
- Exponentiation (unlike typical mathematical practice, multiple uses of
- <literal>^</literal> will associate left to right)
+ Exponentiation
</para>
<para>
<literal>2 ^ 3</literal>
<returnvalue>8</returnvalue>
</para>
<para>
+ Unlike typical mathematical practice, multiple uses of
+ <literal>^</literal> will associate left to right by default:
+ </para>
+ <para>
<literal>2 ^ 3 ^ 3</literal>
<returnvalue>512</returnvalue>
+ </para>
+ <para>
+ <literal>2 ^ (3 ^ 3)</literal>
+ <returnvalue>134217728</returnvalue>
</para></entry>
</row>