postgres.git / summary / log / commit / refs

commit    8344979d5bbc63aa8fb8c804bd933c887a2abb58
Author:   Tom Lane <tgl@sss.pgh.pa.us>
Date:     Wed Jul 21 22:03:33 2021 +0000
First released in: 15.0, 13.4, 14.0

    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


doc/src/sgml/func.sgml | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml index 5dea1aa986e..32328de46d5 100644 --- a/doc/src/sgml/func.sgml +++ b/doc/src/sgml/func.sgml @@ -1007,16 +1007,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> [parent: 0b5dc1f171c4]