它在哪里被权威地记录了(expr,expr,...)语法是什么? [英] Where is it authoritatively documented what the (expr,expr,...) syntax does?

查看:137
本文介绍了它在哪里被权威地记录了(expr,expr,...)语法是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

另一个问题中,断言以下条件条件是等价的:

In another question, it was asserted that the following conditional criteria are equivalent:

(a,b,c,d) != (1,2,3,4)                  -- (1)
(a != 1 OR b != 2 OR c != 3 OR d != 4)  -- (2)

(a,b,c,d)构造的解析规则(注意它不是一个子查询)是 simple_expr 这里有一个语法生产

The parsing rule for the (a,b,c,d) construct (note that it is not a subquery) is simple_expr and there's a grammatical production for it there.

但是,我找不到任何文档上述条件(1)的行为和我的直觉告诉我,这不是相当于(2 )

However, I cannot find any documentation at all for the behaviour of the above conditional (1), and my gut is telling me that it is not equivalent to (2).


  • 此表达式在此上下文中的行为在

  • Where is the behaviour of this expression in this context documented?

(答案必须权威的来源,或者说不存在,而且我们必须通过经验证据推断表达的行为。)

(Answers must reference authoritative sources, or state that none exist and that we have to deduce the expression's behaviour through empirical evidence only.)

推荐答案

p>有可能有冲突的相关信息此处,那谈论每个操作数的行的隐含构造,以及关于>行分类比较

There is potentially conflicting pertinent information here, that talks about the implicit construction of a "row" for each operand, and about row-wise comparison.

它只说 AND 用于排序规则:


行构造函数在其他上下文中是合法的。例如,两个语句之后的
语义上相当:

Row constructors are legal in other contexts. For example, the following two statements are semantically equivalent:

SELECT * FROM t1 WHERE (column1,column2) = (1,1);
SELECT * FROM t1 WHERE column1 = 1 AND column2 = 1;


尽管PostgreSQL 有点更精确

It goes into no specifics, though PostgreSQL is a bit more precise:


如果所有对应的成员都是
非空且相等,则两行被视为相等;如果任何相应的成员
为非空且不相等,那么这些行是不相等的;否则行比较
的结果是未知(null)。

Two rows are considered equal if all their corresponding members are non-null and equal; the rows are unequal if any corresponding members are non-null and unequal; otherwise the result of the row comparison is unknown (null).

根据MySQL文档的使用示例, code> = 和实证证据使用!= (和阿里尔说,应用程序!((a = 1)AND(b = 2)...) 适合),我想我们只需要解决上述PostgreSQL引用也适用于MySQL(并提交文档错误!)。

Based on the MySQL documentation examples for usage of =, and empirical evidence for usage of != (and, as Ariel says, the application !((a = 1) AND (b = 2) ...) fits), I think we'll just have to settle for presuming that the above PostgreSQL citation also applies for MySQL (and file a documentation bug!).

这篇关于它在哪里被权威地记录了(expr,expr,...)语法是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆