Even better example for operator precedence mis-parsing.
authorPeter Eisentraut <peter_e@gmx.net>
Sun, 25 Feb 2001 16:05:21 +0000 (16:05 +0000)
committerPeter Eisentraut <peter_e@gmx.net>
Sun, 25 Feb 2001 16:05:21 +0000 (16:05 +0000)
doc/src/sgml/syntax.sgml

index 0adf395a4f94bf92dcf1a618a03cd8a4e2bf23f0..90255870b2f5ebc56b8079231d2669613451b4cf 100644 (file)
@@ -905,17 +905,17 @@ sqrt(2)
     you will sometimes need to add parentheses when using combinations
     of binary and unary operators.  For instance
 <programlisting>
-SELECT 5 ! + 6;
+SELECT 5 ! - 6;
 </programlisting>
    will be parsed as
 <programlisting>
-SELECT 5 ! (+ 6);
+SELECT 5 ! (- 6);
 </programlisting>
     because the parser has no idea -- until it is too late -- that
     <token>!</token> is defined as a postfix operator, not an infix one.
     To get the desired behavior in this case, you must write
 <programlisting>
-SELECT (5 !) + 6;
+SELECT (5 !) - 6;
 </programlisting>
     This is the price one pays for extensibility.
    </para>