Moritz Bruder
7 years ago
Hi,
I just came across a strange behaviour in sqlite3 (3.22.0 2018-01-22
18:45:57
0c55d179733b46d8d0ba4d88e01a25e10677046ee3da1d5b1581e86726f2171d).
Consider the following test case:
CREATE TABLE test (name varchar);
INSERT INTO test VALUES ("foo"),("bar");
-- Returns a single row with a single column: 'foo!'
SELECT (test.name || '!') AS tname
FROM test
WHERE tname = 'foo!'
--Returns an empty result.
SELECT (test.name || '!') AS name
FROM test
WHERE name = 'foo!';
What happens is that the identifier "name", defined in the
SELECT-clause, gets shadowed by the table's column "name". I'm not
exactly sure what the SQL standard says but it is wrong in my opinion. I
expect it to be the other way round.Let me know whether you consider it
a bug.
Best wishes,
Moritz
I just came across a strange behaviour in sqlite3 (3.22.0 2018-01-22
18:45:57
0c55d179733b46d8d0ba4d88e01a25e10677046ee3da1d5b1581e86726f2171d).
Consider the following test case:
CREATE TABLE test (name varchar);
INSERT INTO test VALUES ("foo"),("bar");
-- Returns a single row with a single column: 'foo!'
SELECT (test.name || '!') AS tname
FROM test
WHERE tname = 'foo!'
--Returns an empty result.
SELECT (test.name || '!') AS name
FROM test
WHERE name = 'foo!';
What happens is that the identifier "name", defined in the
SELECT-clause, gets shadowed by the table's column "name". I'm not
exactly sure what the SQL standard says but it is wrong in my opinion. I
expect it to be the other way round.Let me know whether you consider it
a bug.
Best wishes,
Moritz