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
c6b0d336
Commit
c6b0d336
authored
Nov 11, 2002
by
Sinisa@sinisa.nasamreza.org
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
some bug fixes related to derived tables
parent
408d7b2d
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
31 additions
and
6 deletions
+31
-6
mysql-test/r/derived.result
mysql-test/r/derived.result
+13
-0
mysql-test/t/derived.test
mysql-test/t/derived.test
+10
-0
sql/sql_base.cc
sql/sql_base.cc
+3
-1
sql/sql_parse.cc
sql/sql_parse.cc
+5
-5
No files found.
mysql-test/r/derived.result
View file @
c6b0d336
...
@@ -17,6 +17,19 @@ select t1.a,t4.y from t1,(select t2.a as y from t2,(select t3.b from t3 where t3
...
@@ -17,6 +17,19 @@ select t1.a,t4.y from t1,(select t2.a as y from t2,(select t3.b from t3 where t3
a y
a y
3 3
3 3
3 3
3 3
SELECT a FROM (SELECT 1 FROM (SELECT 1) HAVING a=1);
Unknown column 'a' in 'having clause'
SELECT a,b as a FROM (SELECT '1' as a,'2' as b) HAVING a=1;
Column: 'a' in having clause is ambiguous
SELECT a,2 as a FROM (SELECT '1' as a) HAVING a=2;
a a
1 2
SELECT a,2 as a FROM (SELECT '1' as a) HAVING a=1;
a a
SELECT 1 FROM (SELECT 1) WHERE a=2;
Unknown column 'a' in 'where clause'
SELECT (SELECT 1) as a FROM (SELECT 1 FROM t1 HAVING a=1);
Unknown column 'a' in 'having clause'
drop table if exists t1.t2,t3;
drop table if exists t1.t2,t3;
select * from (select 1);
select * from (select 1);
1
1
...
...
mysql-test/t/derived.test
View file @
c6b0d336
...
@@ -8,6 +8,16 @@ select t1.a,t3.a from t1,(select * from t2 where b='c') as t3 where t1.a = t3.
...
@@ -8,6 +8,16 @@ select t1.a,t3.a from t1,(select * from t2 where b='c') as t3 where t1.a = t3.
CREATE
TABLE
t3
(
a
int
not
null
,
b
char
(
10
)
not
null
);
CREATE
TABLE
t3
(
a
int
not
null
,
b
char
(
10
)
not
null
);
insert
into
t3
values
(
3
,
'f'
),(
4
,
'y'
),(
5
,
'z'
),(
6
,
'c'
);
insert
into
t3
values
(
3
,
'f'
),(
4
,
'y'
),(
5
,
'z'
),(
6
,
'c'
);
select
t1
.
a
,
t4
.
y
from
t1
,(
select
t2
.
a
as
y
from
t2
,(
select
t3
.
b
from
t3
where
t3
.
a
>
3
)
as
t5
where
t2
.
b
=
t5
.
b
)
as
t4
where
t1
.
a
=
t4
.
y
;
select
t1
.
a
,
t4
.
y
from
t1
,(
select
t2
.
a
as
y
from
t2
,(
select
t3
.
b
from
t3
where
t3
.
a
>
3
)
as
t5
where
t2
.
b
=
t5
.
b
)
as
t4
where
t1
.
a
=
t4
.
y
;
--
error
1054
SELECT
a
FROM
(
SELECT
1
FROM
(
SELECT
1
)
HAVING
a
=
1
);
--
error
1052
SELECT
a
,
b
as
a
FROM
(
SELECT
'1'
as
a
,
'2'
as
b
)
HAVING
a
=
1
;
SELECT
a
,
2
as
a
FROM
(
SELECT
'1'
as
a
)
HAVING
a
=
2
;
SELECT
a
,
2
as
a
FROM
(
SELECT
'1'
as
a
)
HAVING
a
=
1
;
--
error
1054
SELECT
1
FROM
(
SELECT
1
)
WHERE
a
=
2
;
--
error
1054
SELECT
(
SELECT
1
)
as
a
FROM
(
SELECT
1
FROM
t1
HAVING
a
=
1
);
drop
table
if
exists
t1
.
t2
,
t3
;
drop
table
if
exists
t1
.
t2
,
t3
;
select
*
from
(
select
1
);
select
*
from
(
select
1
);
select
a
from
(
select
1
as
a
);
select
a
from
(
select
1
as
a
);
sql/sql_base.cc
View file @
c6b0d336
...
@@ -1748,7 +1748,9 @@ Field *find_field_in_table(THD *thd,TABLE *table,const char *name,uint length,
...
@@ -1748,7 +1748,9 @@ Field *find_field_in_table(THD *thd,TABLE *table,const char *name,uint length,
}
}
else
else
{
{
Field
**
ptr
=
table
->
field
;
Field
**
ptr
;
if
(
!
(
ptr
=
table
->
field
))
return
(
Field
*
)
0
;
while
((
field
=
*
ptr
++
))
while
((
field
=
*
ptr
++
))
{
{
if
(
!
my_strcasecmp
(
system_charset_info
,
field
->
field_name
,
name
))
if
(
!
my_strcasecmp
(
system_charset_info
,
field
->
field_name
,
name
))
...
...
sql/sql_parse.cc
View file @
c6b0d336
...
@@ -1332,11 +1332,6 @@ mysql_execute_command(THD *thd)
...
@@ -1332,11 +1332,6 @@ mysql_execute_command(THD *thd)
TODO: make derived tables processing 'inside' SELECT processing.
TODO: make derived tables processing 'inside' SELECT processing.
TODO: solve problem with depended derived tables in subselects
TODO: solve problem with depended derived tables in subselects
*/
*/
if
((
lex
->
select_lex
.
next_select_in_list
()
&&
lex
->
unit
.
create_total_list
(
thd
,
lex
,
&
tables
))
||
(
table_rules_on
&&
tables
&&
thd
->
slave_thread
&&
!
tables_ok
(
thd
,
tables
)))
DBUG_VOID_RETURN
;
if
(
lex
->
derived_tables
)
if
(
lex
->
derived_tables
)
{
{
for
(
TABLE_LIST
*
cursor
=
tables
;
for
(
TABLE_LIST
*
cursor
=
tables
;
...
@@ -1351,6 +1346,11 @@ mysql_execute_command(THD *thd)
...
@@ -1351,6 +1346,11 @@ mysql_execute_command(THD *thd)
DBUG_VOID_RETURN
;
DBUG_VOID_RETURN
;
}
}
}
}
if
((
lex
->
select_lex
.
next_select_in_list
()
&&
lex
->
unit
.
create_total_list
(
thd
,
lex
,
&
tables
))
||
(
table_rules_on
&&
tables
&&
thd
->
slave_thread
&&
!
tables_ok
(
thd
,
tables
)))
DBUG_VOID_RETURN
;
thread_safe_increment
(
com_stat
[
lex
->
sql_command
],
&
LOCK_status
);
thread_safe_increment
(
com_stat
[
lex
->
sql_command
],
&
LOCK_status
);
switch
(
lex
->
sql_command
)
{
switch
(
lex
->
sql_command
)
{
...
...
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