WL#13070: Deprecate && (resp. ||, !) as synonym for AND (OR, NOT) in SQL statements
Affects: Server-8.0 — Status: Complete
In MySQL, the following two statements are synonymous: SELECT * FROM t WHERE a > 0 AND b > 0; SELECT * FROM t WHERE a > 0 && b > 0; Likewise for the OR operator: SELECT * FROM t WHERE a > 0 OR b > 0; SELECT * FROM t WHERE a > 0 || b > 0; And for the NOT operator: SELECT * FROM t WHERE NOT a > 0; SELECT * FROM t WHERE ! a > 0; The operators &&, || and ! are all invalid according to the SQL standard and are completely redundant. In addition, we do not think they are used much in actual SQL statements. In addition, the || symbol conflicts with the standard SQL concatenation operator. When this has been removed as synonym for OR, we can allow || as concatenation operator without requiring a special SQL mode (PIPES_AS_CONCAT, currently).
F1 A warning should be sent when the query uses one of these operators: - ! (warning should suggest NOT) - && (warning should suggest AND) - || if sql_mode doesn't have the PIPES_AS_CONCAT flag (in which case || does OR, not CONCAT) (warning should suggest OR). F2 No other behaviour change
Copyright (c) 2000, 2021, Oracle Corporation and/or its affiliates. All rights reserved.