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
251409bb
Commit
251409bb
authored
Aug 24, 2006
by
unknown
Browse files
Options
Browse Files
Download
Plain Diff
BUG#16255: Merge to 5.0
parents
d0394c70
f895a16c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
69 additions
and
25 deletions
+69
-25
mysql-test/r/subselect.result
mysql-test/r/subselect.result
+22
-0
mysql-test/t/subselect.test
mysql-test/t/subselect.test
+24
-1
sql/item_subselect.cc
sql/item_subselect.cc
+23
-24
No files found.
mysql-test/r/subselect.result
View file @
251409bb
...
...
@@ -2915,6 +2915,28 @@ select * from t1 where NOT(s1 = ALL (select s1/s1 from t1));
s1
2
drop table t1;
create table t1 (
retailerID varchar(8) NOT NULL,
statusID int(10) unsigned NOT NULL,
changed datetime NOT NULL,
UNIQUE KEY retailerID (retailerID, statusID, changed)
);
INSERT INTO t1 VALUES("0026", "1", "2005-12-06 12:18:56");
INSERT INTO t1 VALUES("0026", "2", "2006-01-06 12:25:53");
INSERT INTO t1 VALUES("0037", "1", "2005-12-06 12:18:56");
INSERT INTO t1 VALUES("0037", "2", "2006-01-06 12:25:53");
INSERT INTO t1 VALUES("0048", "1", "2006-01-06 12:37:50");
INSERT INTO t1 VALUES("0059", "1", "2006-01-06 12:37:50");
select * from t1 r1
where (r1.retailerID,(r1.changed)) in
(SELECT r2.retailerId,(max(changed)) from t1 r2
group by r2.retailerId);
retailerID statusID changed
0026 2 2006-01-06 12:25:53
0037 2 2006-01-06 12:25:53
0048 1 2006-01-06 12:37:50
0059 1 2006-01-06 12:37:50
drop table t1;
create table t1 (df decimal(5,1));
insert into t1 values(1.1);
insert into t1 values(2.2);
...
...
mysql-test/t/subselect.test
View file @
251409bb
...
...
@@ -1868,7 +1868,30 @@ select * from t1 where NOT(s1+1 = ANY (select s1 from t1));
select
*
from
t1
where
(
s1
=
ALL
(
select
s1
/
s1
from
t1
));
select
*
from
t1
where
NOT
(
s1
=
ALL
(
select
s1
/
s1
from
t1
));
drop
table
t1
;
# End of 4.1 tests
#
# Bug #16255: Subquery in where
#
create
table
t1
(
retailerID
varchar
(
8
)
NOT
NULL
,
statusID
int
(
10
)
unsigned
NOT
NULL
,
changed
datetime
NOT
NULL
,
UNIQUE
KEY
retailerID
(
retailerID
,
statusID
,
changed
)
);
INSERT
INTO
t1
VALUES
(
"0026"
,
"1"
,
"2005-12-06 12:18:56"
);
INSERT
INTO
t1
VALUES
(
"0026"
,
"2"
,
"2006-01-06 12:25:53"
);
INSERT
INTO
t1
VALUES
(
"0037"
,
"1"
,
"2005-12-06 12:18:56"
);
INSERT
INTO
t1
VALUES
(
"0037"
,
"2"
,
"2006-01-06 12:25:53"
);
INSERT
INTO
t1
VALUES
(
"0048"
,
"1"
,
"2006-01-06 12:37:50"
);
INSERT
INTO
t1
VALUES
(
"0059"
,
"1"
,
"2006-01-06 12:37:50"
);
select
*
from
t1
r1
where
(
r1
.
retailerID
,(
r1
.
changed
))
in
(
SELECT
r2
.
retailerId
,(
max
(
changed
))
from
t1
r2
group
by
r2
.
retailerId
);
drop
table
t1
;
# End of 4.1 tests
#
...
...
sql/item_subselect.cc
View file @
251409bb
...
...
@@ -1098,24 +1098,23 @@ Item_in_subselect::row_value_transformer(JOIN *join)
DBUG_RETURN
(
RES_ERROR
);
Item
*
item_eq
=
new
Item_func_eq
(
new
Item_
direct_
ref
(
&
select_lex
->
context
,
(
*
optimizer
->
get_cache
())
->
addr
(
i
),
(
char
*
)
"<no matter>"
,
(
char
*
)
in_left_expr_name
),
Item_ref
(
&
select_lex
->
context
,
(
*
optimizer
->
get_cache
())
->
addr
(
i
),
(
char
*
)
"<no matter>"
,
(
char
*
)
in_left_expr_name
),
new
Item_
direct_
ref
(
&
select_lex
->
context
,
select_lex
->
ref_pointer_array
+
i
,
(
char
*
)
"<no matter>"
,
(
char
*
)
"<list ref>"
)
Item_ref
(
&
select_lex
->
context
,
select_lex
->
ref_pointer_array
+
i
,
(
char
*
)
"<no matter>"
,
(
char
*
)
"<list ref>"
)
);
Item
*
item_isnull
=
new
Item_func_isnull
(
new
Item_direct_ref
(
&
select_lex
->
context
,
select_lex
->
ref_pointer_array
+
i
,
(
char
*
)
"<no matter>"
,
(
char
*
)
"<list ref>"
)
Item_ref
(
&
select_lex
->
context
,
select_lex
->
ref_pointer_array
+
i
,
(
char
*
)
"<no matter>"
,
(
char
*
)
"<list ref>"
)
);
having_item
=
and_items
(
having_item
,
...
...
@@ -1125,11 +1124,11 @@ Item_in_subselect::row_value_transformer(JOIN *join)
new
Item_is_not_null_test
(
this
,
new
Item_
direct_
ref
(
&
select_lex
->
context
,
select_lex
->
ref_pointer_array
+
i
,
(
char
*
)
"<no matter>"
,
(
char
*
)
"<list ref>"
)
Item_ref
(
&
select_lex
->
context
,
select_lex
->
ref_pointer_array
+
i
,
(
char
*
)
"<no matter>"
,
(
char
*
)
"<list ref>"
)
)
);
item_having_part2
->
top_level_item
();
...
...
@@ -1185,11 +1184,11 @@ Item_in_subselect::row_value_transformer(JOIN *join)
new
Item_is_not_null_test
(
this
,
new
Item_
direct_
ref
(
&
select_lex
->
context
,
select_lex
->
ref_pointer_array
+
i
,
(
char
*
)
"<no matter>"
,
(
char
*
)
"<list ref>"
)
Item_ref
(
&
select_lex
->
context
,
select_lex
->
ref_pointer_array
+
i
,
(
char
*
)
"<no matter>"
,
(
char
*
)
"<list ref>"
)
)
);
item_isnull
=
new
...
...
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