Parser accepts invalid column names
(1) By anonymous on 2021-12-24 10:48:59 [source]
In some cases the parser accepts an arbitrary (non-existing) database alias as part of column names. I looks like this is accepted when accessing an aliased subquery.
Example
SELECT *
FROM (SELECT 42 AS val1) AS tbl1,
(SELECT 42 AS val2) AS tbl2
WHERE any_name_is_allowed_here.tbl2.val2 = any_name_is_allowed_here_too.tbl1.val1;
val1|val2
42|42
Tested with version 3.34 and 3.22.
Regards, Rob G
(2) By Harald Hanche-Olsen (hanche) on 2021-12-24 13:05:46 in reply to 1 [link] [source]
It would appear that when you refer to ⟨schema⟩.⟨table⟩.⟨column⟩ and ⟨table⟩ is a valid alias name, then ⟨schema⟩ is ignored.
(3) By Richard Hipp (drh) on 2021-12-24 13:32:15 in reply to 1 [link] [source]
Thanks for the report. Now fixed on trunk.