Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
9e2d9aa2
Commit
9e2d9aa2
authored
Dec 17, 2002
by
bell@sanja.is.com.ua
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed derived table visibility scope for derived tables with union
parent
e56fb196
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
4 deletions
+16
-4
mysql-test/r/derived.result
mysql-test/r/derived.result
+4
-0
mysql-test/t/derived.test
mysql-test/t/derived.test
+4
-0
sql/item.cc
sql/item.cc
+8
-4
No files found.
mysql-test/r/derived.result
View file @
9e2d9aa2
SELECT 1 as a FROM (SELECT 1 UNION SELECT a) b;
Unknown column 'a' in 'field list'
SELECT 1 as a FROM (SELECT a UNION SELECT 1) b;
Unknown column 'a' in 'field list'
drop table if exists t1,t2,t3;
CREATE TABLE t1 (a int not null, b char (10) not null);
insert into t1 values(1,'a'),(2,'b'),(3,'c'),(3,'c');
...
...
mysql-test/t/derived.test
View file @
9e2d9aa2
--
error
1054
SELECT
1
as
a
FROM
(
SELECT
1
UNION
SELECT
a
)
b
;
--
error
1054
SELECT
1
as
a
FROM
(
SELECT
a
UNION
SELECT
1
)
b
;
drop
table
if
exists
t1
,
t2
,
t3
;
CREATE
TABLE
t1
(
a
int
not
null
,
b
char
(
10
)
not
null
);
insert
into
t1
values
(
1
,
'a'
),(
2
,
'b'
),(
3
,
'c'
),(
3
,
'c'
);
...
...
sql/item.cc
View file @
9e2d9aa2
...
...
@@ -573,7 +573,8 @@ bool Item_field::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
Item
**
refer
=
(
Item
**
)
not_found_item
;
// Prevent using outer fields in subselects, that is not supported now
SELECT_LEX
*
cursel
=
(
SELECT_LEX
*
)
thd
->
lex
.
current_select
;
if
(
cursel
->
linkage
!=
DERIVED_TABLE_TYPE
)
if
(
cursel
->
master_unit
()
->
first_select
()
->
linkage
!=
DERIVED_TABLE_TYPE
)
for
(
SELECT_LEX
*
sl
=
cursel
->
outer_select
();
sl
;
sl
=
sl
->
outer_select
())
...
...
@@ -586,7 +587,8 @@ bool Item_field::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
REPORT_EXCEPT_NOT_FOUND
))
!=
(
Item
**
)
not_found_item
)
break
;
if
(
sl
->
linkage
==
DERIVED_TABLE_TYPE
)
if
(
sl
->
master_unit
()
->
first_select
()
->
linkage
==
DERIVED_TABLE_TYPE
)
break
;
// do not look over derived table
}
if
(
!
tmp
)
...
...
@@ -1024,7 +1026,8 @@ bool Item_ref::fix_fields(THD *thd,TABLE_LIST *tables, Item **reference)
if
((
ref
=
find_item_in_list
(
this
,
*
(
thd
->
lex
.
current_select
->
get_item_list
()),
((
sl
&&
thd
->
lex
.
current_select
->
linkage
!=
thd
->
lex
.
current_select
->
master_unit
()
->
first_select
()
->
linkage
!=
DERIVED_TABLE_TYPE
)
?
REPORT_EXCEPT_NOT_FOUND
:
REPORT_ALL_ERRORS
)))
==
...
...
@@ -1050,7 +1053,8 @@ bool Item_ref::fix_fields(THD *thd,TABLE_LIST *tables, Item **reference)
if
((
tmp
=
find_field_in_tables
(
thd
,
this
,
sl
->
get_table_list
(),
0
))
!=
not_found_field
);
if
(
sl
->
linkage
==
DERIVED_TABLE_TYPE
)
if
(
sl
->
master_unit
()
->
first_select
()
->
linkage
==
DERIVED_TABLE_TYPE
)
break
;
// do not look over derived table
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment