提交 3460181c 编写于 作者: P Peter Eisentraut

Choose a more suitable example for the operator precedence mis-parsing

example.
上级 2db9d5e5
<!--
$Header: /cvsroot/pgsql/doc/src/sgml/syntax.sgml,v 1.39 2001/02/10 07:08:44 tgl Exp $
$Header: /cvsroot/pgsql/doc/src/sgml/syntax.sgml,v 1.40 2001/02/24 18:09:51 petere Exp $
-->
<chapter id="sql-syntax">
......@@ -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's too late --- that
<token>!</token> is defined as a postfix operator not an infix one.
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>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册