由于 Postgresql 9.5 中的运算符优先级更改而改变其含义的条件有哪些示例?

What are some examples for conditions that change their meaning due to operator precedence changes in Postgresql 9.5?

在 Postgresql 9.5 中,发行说明中列出的破坏向后兼容性的更改之一是:

Adjust operator precedence to match the SQL standard (Tom Lane)

The precedence of <=, >= and <> has been reduced to match that of <, > and =. The precedence of IS tests (e.g., x IS NULL) has been reduced to be just below these six comparison operators. Also, multi-keyword operators beginning with NOT now have the precedence of their base operator (for example, NOT BETWEEN now has the same precedence as BETWEEN) whereas before they had inconsistent precedence, behaving like NOT with respect to their left operand but like their base operator with respect to their right operand. The new configuration parameter operator_precedence_warning can be enabled to warn about queries in which these precedence changes result in different parsing choices.

由于上述更改,我发现很难想出一个改变其含义的查询。此类查询有哪些示例?

New precedence table

Old precedence table

select 1>2 is true;

在 9.4 中将被解释为 select 1> (2 is true);,这是无效的并抛出错误 error: argument of IS TRUE must be type boolean, not type integer

在 9.5 中它将被解释为 select (1>2) is true;,这是有效的并且 return false.

这些版本仍可在 db-fiddle 上进行测试。