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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
c30f7feb
Commit
c30f7feb
authored
Feb 14, 2005
by
sergefp@mysql.com
Browse files
Options
Browse Files
Download
Plain Diff
Merge spetrunia@bk-internal.mysql.com:/home/bk/mysql-4.1
into mysql.com:/home/psergey/mysql-4.1-bug8218
parents
ac7dd826
021f9849
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
208 additions
and
5 deletions
+208
-5
mysql-test/r/subselect.result
mysql-test/r/subselect.result
+100
-0
mysql-test/t/subselect.test
mysql-test/t/subselect.test
+101
-0
sql/sql_class.h
sql/sql_class.h
+6
-3
sql/sql_select.cc
sql/sql_select.cc
+1
-2
No files found.
mysql-test/r/subselect.result
View file @
c30f7feb
...
@@ -2168,3 +2168,103 @@ ERROR 42S22: Reference 'xx' not supported (forward reference in item list)
...
@@ -2168,3 +2168,103 @@ ERROR 42S22: Reference 'xx' not supported (forward reference in item list)
select 1 = ALL (select 1 from t1 where 1 = xx ), 1 as xx from DUAL;
select 1 = ALL (select 1 from t1 where 1 = xx ), 1 as xx from DUAL;
ERROR 42S22: Reference 'xx' not supported (forward reference in item list)
ERROR 42S22: Reference 'xx' not supported (forward reference in item list)
drop table t1;
drop table t1;
CREATE TABLE t1 (
categoryId int(11) NOT NULL,
courseId int(11) NOT NULL,
startDate datetime NOT NULL,
endDate datetime NOT NULL,
createDate datetime NOT NULL,
modifyDate timestamp NOT NULL,
attributes text NOT NULL
);
INSERT INTO t1 VALUES (1,41,'2004-02-09','2010-01-01','2004-02-09','2004-02-09',''),
(1,86,'2004-08-16','2004-08-16','2004-08-16','2004-08-16',''),
(1,87,'2004-08-16','2004-08-16','2004-08-16','2004-08-16',''),
(2,52,'2004-03-15','2004-10-01','2004-03-15','2004-09-17',''),
(2,53,'2004-03-16','2004-10-01','2004-03-16','2004-09-17',''),
(2,88,'2004-08-16','2004-08-16','2004-08-16','2004-08-16',''),
(2,89,'2004-08-16','2004-08-16','2004-08-16','2004-08-16',''),
(3,51,'2004-02-09','2010-01-01','2004-02-09','2004-02-09',''),
(5,12,'2004-02-18','2010-01-01','2004-02-18','2004-02-18','');
CREATE TABLE t2 (
userId int(11) NOT NULL,
courseId int(11) NOT NULL,
date datetime NOT NULL
);
INSERT INTO t2 VALUES (5141,71,'2003-11-18'),
(5141,72,'2003-11-25'),(5141,41,'2004-08-06'),
(5141,52,'2004-08-06'),(5141,53,'2004-08-06'),
(5141,12,'2004-08-06'),(5141,86,'2004-10-21'),
(5141,87,'2004-10-21'),(5141,88,'2004-10-21'),
(5141,89,'2004-10-22'),(5141,51,'2004-10-26');
CREATE TABLE t3 (
groupId int(11) NOT NULL,
parentId int(11) NOT NULL,
startDate datetime NOT NULL,
endDate datetime NOT NULL,
createDate datetime NOT NULL,
modifyDate timestamp NOT NULL,
ordering int(11)
);
INSERT INTO t3 VALUES (12,9,'1000-01-01','3999-12-31','2004-01-29','2004-01-29',NULL);
CREATE TABLE t4 (
id int(11) NOT NULL,
groupTypeId int(11) NOT NULL,
groupKey varchar(50) NOT NULL,
name text,
ordering int(11),
description text,
createDate datetime NOT NULL,
modifyDate timestamp NOT NULL
);
INSERT INTO t4 VALUES (9,5,'stationer','stationer',0,'Stationer','2004-01-29','2004-01-29'),
(12,5,'group2','group2',0,'group2','2004-01-29','2004-01-29');
CREATE TABLE t5 (
userId int(11) NOT NULL,
groupId int(11) NOT NULL,
createDate datetime NOT NULL,
modifyDate timestamp NOT NULL
);
INSERT INTO t5 VALUES (5141,12,'2004-08-06','2004-08-06');
select
count(distinct t2.userid) pass,
groupstuff.*,
count(t2.courseid) crse,
t1.categoryid,
t2.courseid,
date_format(date, '%b%y') as colhead
from t2
join t1 on t2.courseid=t1.courseid
join
(
select
t5.userid,
parentid,
parentgroup,
childid,
groupname,
grouptypeid
from t5
join
(
select t4.id as parentid,
t4.name as parentgroup,
t4.id as childid,
t4.name as groupname,
t4.grouptypeid
from t4
) as gin on t5.groupid=gin.childid
) as groupstuff on t2.userid = groupstuff.userid
group by
groupstuff.groupname, colhead , t2.courseid;
pass userid parentid parentgroup childid groupname grouptypeid crse categoryid courseid colhead
1 5141 12 group2 12 group2 5 1 5 12 Aug04
1 5141 12 group2 12 group2 5 1 1 41 Aug04
1 5141 12 group2 12 group2 5 1 2 52 Aug04
1 5141 12 group2 12 group2 5 1 2 53 Aug04
1 5141 12 group2 12 group2 5 1 3 51 Oct04
1 5141 12 group2 12 group2 5 1 1 86 Oct04
1 5141 12 group2 12 group2 5 1 1 87 Oct04
1 5141 12 group2 12 group2 5 1 2 88 Oct04
1 5141 12 group2 12 group2 5 1 2 89 Oct04
drop table if exists t1, t2, t3, t4, t5;
mysql-test/t/subselect.test
View file @
c30f7feb
...
@@ -1437,3 +1437,104 @@ select 1 = ALL (select 1 from t1 where 1 = xx ), 1 as xx;
...
@@ -1437,3 +1437,104 @@ select 1 = ALL (select 1 from t1 where 1 = xx ), 1 as xx;
--
error
1247
--
error
1247
select
1
=
ALL
(
select
1
from
t1
where
1
=
xx
),
1
as
xx
from
DUAL
;
select
1
=
ALL
(
select
1
from
t1
where
1
=
xx
),
1
as
xx
from
DUAL
;
drop
table
t1
;
drop
table
t1
;
# Test for BUG#8218
CREATE
TABLE
t1
(
categoryId
int
(
11
)
NOT
NULL
,
courseId
int
(
11
)
NOT
NULL
,
startDate
datetime
NOT
NULL
,
endDate
datetime
NOT
NULL
,
createDate
datetime
NOT
NULL
,
modifyDate
timestamp
NOT
NULL
,
attributes
text
NOT
NULL
);
INSERT
INTO
t1
VALUES
(
1
,
41
,
'2004-02-09'
,
'2010-01-01'
,
'2004-02-09'
,
'2004-02-09'
,
''
),
(
1
,
86
,
'2004-08-16'
,
'2004-08-16'
,
'2004-08-16'
,
'2004-08-16'
,
''
),
(
1
,
87
,
'2004-08-16'
,
'2004-08-16'
,
'2004-08-16'
,
'2004-08-16'
,
''
),
(
2
,
52
,
'2004-03-15'
,
'2004-10-01'
,
'2004-03-15'
,
'2004-09-17'
,
''
),
(
2
,
53
,
'2004-03-16'
,
'2004-10-01'
,
'2004-03-16'
,
'2004-09-17'
,
''
),
(
2
,
88
,
'2004-08-16'
,
'2004-08-16'
,
'2004-08-16'
,
'2004-08-16'
,
''
),
(
2
,
89
,
'2004-08-16'
,
'2004-08-16'
,
'2004-08-16'
,
'2004-08-16'
,
''
),
(
3
,
51
,
'2004-02-09'
,
'2010-01-01'
,
'2004-02-09'
,
'2004-02-09'
,
''
),
(
5
,
12
,
'2004-02-18'
,
'2010-01-01'
,
'2004-02-18'
,
'2004-02-18'
,
''
);
CREATE
TABLE
t2
(
userId
int
(
11
)
NOT
NULL
,
courseId
int
(
11
)
NOT
NULL
,
date
datetime
NOT
NULL
);
INSERT
INTO
t2
VALUES
(
5141
,
71
,
'2003-11-18'
),
(
5141
,
72
,
'2003-11-25'
),(
5141
,
41
,
'2004-08-06'
),
(
5141
,
52
,
'2004-08-06'
),(
5141
,
53
,
'2004-08-06'
),
(
5141
,
12
,
'2004-08-06'
),(
5141
,
86
,
'2004-10-21'
),
(
5141
,
87
,
'2004-10-21'
),(
5141
,
88
,
'2004-10-21'
),
(
5141
,
89
,
'2004-10-22'
),(
5141
,
51
,
'2004-10-26'
);
CREATE
TABLE
t3
(
groupId
int
(
11
)
NOT
NULL
,
parentId
int
(
11
)
NOT
NULL
,
startDate
datetime
NOT
NULL
,
endDate
datetime
NOT
NULL
,
createDate
datetime
NOT
NULL
,
modifyDate
timestamp
NOT
NULL
,
ordering
int
(
11
)
);
INSERT
INTO
t3
VALUES
(
12
,
9
,
'1000-01-01'
,
'3999-12-31'
,
'2004-01-29'
,
'2004-01-29'
,
NULL
);
CREATE
TABLE
t4
(
id
int
(
11
)
NOT
NULL
,
groupTypeId
int
(
11
)
NOT
NULL
,
groupKey
varchar
(
50
)
NOT
NULL
,
name
text
,
ordering
int
(
11
),
description
text
,
createDate
datetime
NOT
NULL
,
modifyDate
timestamp
NOT
NULL
);
INSERT
INTO
t4
VALUES
(
9
,
5
,
'stationer'
,
'stationer'
,
0
,
'Stationer'
,
'2004-01-29'
,
'2004-01-29'
),
(
12
,
5
,
'group2'
,
'group2'
,
0
,
'group2'
,
'2004-01-29'
,
'2004-01-29'
);
CREATE
TABLE
t5
(
userId
int
(
11
)
NOT
NULL
,
groupId
int
(
11
)
NOT
NULL
,
createDate
datetime
NOT
NULL
,
modifyDate
timestamp
NOT
NULL
);
INSERT
INTO
t5
VALUES
(
5141
,
12
,
'2004-08-06'
,
'2004-08-06'
);
select
count
(
distinct
t2
.
userid
)
pass
,
groupstuff
.*
,
count
(
t2
.
courseid
)
crse
,
t1
.
categoryid
,
t2
.
courseid
,
date_format
(
date
,
'%b%y'
)
as
colhead
from
t2
join
t1
on
t2
.
courseid
=
t1
.
courseid
join
(
select
t5
.
userid
,
parentid
,
parentgroup
,
childid
,
groupname
,
grouptypeid
from
t5
join
(
select
t4
.
id
as
parentid
,
t4
.
name
as
parentgroup
,
t4
.
id
as
childid
,
t4
.
name
as
groupname
,
t4
.
grouptypeid
from
t4
)
as
gin
on
t5
.
groupid
=
gin
.
childid
)
as
groupstuff
on
t2
.
userid
=
groupstuff
.
userid
group
by
groupstuff
.
groupname
,
colhead
,
t2
.
courseid
;
drop
table
if
exists
t1
,
t2
,
t3
,
t4
,
t5
;
sql/sql_class.h
View file @
c30f7feb
...
@@ -1295,7 +1295,11 @@ public:
...
@@ -1295,7 +1295,11 @@ public:
#include <myisam.h>
#include <myisam.h>
/* Param to create temporary tables when doing SELECT:s */
/*
Param to create temporary tables when doing SELECT:s
NOTE
This structure is copied using memcpy as a part of JOIN.
*/
class
TMP_TABLE_PARAM
:
public
Sql_alloc
class
TMP_TABLE_PARAM
:
public
Sql_alloc
{
{
...
@@ -1307,7 +1311,6 @@ private:
...
@@ -1307,7 +1311,6 @@ private:
public:
public:
List
<
Item
>
copy_funcs
;
List
<
Item
>
copy_funcs
;
List
<
Item
>
save_copy_funcs
;
List
<
Item
>
save_copy_funcs
;
List_iterator_fast
<
Item
>
copy_funcs_it
;
Copy_field
*
copy_field
,
*
copy_field_end
;
Copy_field
*
copy_field
,
*
copy_field_end
;
Copy_field
*
save_copy_field
,
*
save_copy_field_end
;
Copy_field
*
save_copy_field
,
*
save_copy_field_end
;
byte
*
group_buff
;
byte
*
group_buff
;
...
@@ -1324,7 +1327,7 @@ public:
...
@@ -1324,7 +1327,7 @@ public:
uint
convert_blob_length
;
uint
convert_blob_length
;
TMP_TABLE_PARAM
()
TMP_TABLE_PARAM
()
:
copy_f
uncs_it
(
copy_funcs
),
copy_f
ield
(
0
),
group_parts
(
0
),
:
copy_field
(
0
),
group_parts
(
0
),
group_length
(
0
),
group_null_parts
(
0
),
convert_blob_length
(
0
)
group_length
(
0
),
group_null_parts
(
0
),
convert_blob_length
(
0
)
{}
{}
~
TMP_TABLE_PARAM
()
~
TMP_TABLE_PARAM
()
...
...
sql/sql_select.cc
View file @
c30f7feb
...
@@ -8614,8 +8614,7 @@ copy_fields(TMP_TABLE_PARAM *param)
...
@@ -8614,8 +8614,7 @@ copy_fields(TMP_TABLE_PARAM *param)
for
(;
ptr
!=
end
;
ptr
++
)
for
(;
ptr
!=
end
;
ptr
++
)
(
*
ptr
->
do_copy
)(
ptr
);
(
*
ptr
->
do_copy
)(
ptr
);
List_iterator_fast
<
Item
>
&
it
=
param
->
copy_funcs_it
;
List_iterator_fast
<
Item
>
it
(
param
->
copy_funcs
);
it
.
rewind
();
Item_copy_string
*
item
;
Item_copy_string
*
item
;
while
((
item
=
(
Item_copy_string
*
)
it
++
))
while
((
item
=
(
Item_copy_string
*
)
it
++
))
item
->
copy
();
item
->
copy
();
...
...
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