-
Notifications
You must be signed in to change notification settings - Fork 4.1k
sql: Incorrect result for LIKE query #44123
Copy link
Copy link
Closed
Labels
C-bugCode not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior.Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior.E-quick-winLikely to be a quick win for someone experienced.Likely to be a quick win for someone experienced.S-0-visible-logical-errorDatabase stores inconsistent data in some cases, or queries return invalid results silently.Database stores inconsistent data in some cases, or queries return invalid results silently.T-sql-queriesSQL Queries TeamSQL Queries Team
Description
Consider the following test case:
CREATE TABLE t0(c0 STRING UNIQUE);
INSERT INTO t0 (c0) VALUES ('\a');
SELECT * FROM t0 WHERE c0 LIKE '\a'; -- unexpected: row is fetchedUnexpectedly, the query fetches a row. When removing the UNIQUE constraint, no row is fetched. That the predicate should evaluate to FALSE is also demonstrated by the following query:
SELECT c0 LIKE '\a' FROM t0; -- FALSEI built CockroachDB from source (commit 55c0e012b9539a327640e42ceaaf556b7a0e7b10) on Ubuntu 19.04.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
C-bugCode not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior.Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior.E-quick-winLikely to be a quick win for someone experienced.Likely to be a quick win for someone experienced.S-0-visible-logical-errorDatabase stores inconsistent data in some cases, or queries return invalid results silently.Database stores inconsistent data in some cases, or queries return invalid results silently.T-sql-queriesSQL Queries TeamSQL Queries Team
Type
Projects
Status
Done