mirror of
https://github.com/MariaDB/server.git
synced 2026-05-16 20:07:13 +02:00
MDEV-8913 Derived queries with same column names as final projection causes issues when using Order By
find_item_in_list() now recognize view fields like a fields even if they rever to an expression. The problem of schema name do not taken into account for field with it and derived table fixed. Duplicating code removed
This commit is contained in:
parent
bf186312e1
commit
fa1438cbf4
3 changed files with 78 additions and 30 deletions
|
|
@ -5602,6 +5602,38 @@ SELECT v1.*,v2.* FROM v1 LEFT JOIN v2 ON v1.idAlbum = v2.idAlbum WHERE v1.idAlbu
|
|||
drop view v1,v2;
|
||||
drop table t1,t2,t3,t4;
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-8913: Derived queries with same column names as final
|
||||
--echo # projection causes issues when using Order By
|
||||
--echo #
|
||||
create table t1 (field int);
|
||||
insert into t1 values (10),(5),(3),(8),(20);
|
||||
|
||||
SELECT sq.f2 AS f1, sq.f1 AS f2
|
||||
FROM ( SELECT field AS f1, 1 AS f2 FROM t1) AS sq
|
||||
ORDER BY sq.f1;
|
||||
|
||||
create view v1 as SELECT field AS f1, 1 AS f2 FROM t1;
|
||||
|
||||
SELECT sq.f2 AS f1, sq.f1 AS f2
|
||||
FROM v1 AS sq
|
||||
ORDER BY sq.f1;
|
||||
|
||||
drop view v1;
|
||||
|
||||
create table t2 SELECT field AS f1, 1 AS f2 FROM t1;
|
||||
|
||||
SELECT
|
||||
sq.f2 AS f1,
|
||||
sq.f1 AS f2
|
||||
FROM t2 AS sq
|
||||
ORDER BY sq.f1;
|
||||
|
||||
drop table t1, t2;
|
||||
|
||||
--error ER_BAD_FIELD_ERROR
|
||||
SELECT 1 FROM (SELECT 1 as a) AS b HAVING (SELECT `SOME_GARBAGE`.b.a)=1;
|
||||
|
||||
--echo # -----------------------------------------------------------------
|
||||
--echo # -- End of 10.0 tests.
|
||||
--echo # -----------------------------------------------------------------
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue