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
efc29bc5
Commit
efc29bc5
authored
Mar 27, 2012
by
Tor Didriksen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Backport of fix for Bug#12763207 - ASSERT IN SUBSELECT::SINGLE_VALUE_TRANSFORMER
parent
7ed197c9
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
112 additions
and
1 deletion
+112
-1
mysql-test/r/subselect.result
mysql-test/r/subselect.result
+49
-0
mysql-test/t/subselect.test
mysql-test/t/subselect.test
+55
-0
sql/item_subselect.cc
sql/item_subselect.cc
+7
-1
sql/table.cc
sql/table.cc
+1
-0
No files found.
mysql-test/r/subselect.result
View file @
efc29bc5
...
@@ -4461,6 +4461,55 @@ ERROR 21000: Subquery returns more than 1 row
...
@@ -4461,6 +4461,55 @@ ERROR 21000: Subquery returns more than 1 row
SET SESSION sql_mode=@old_sql_mode;
SET SESSION sql_mode=@old_sql_mode;
DEALLOCATE PREPARE stmt;
DEALLOCATE PREPARE stmt;
DROP TABLE t1;
DROP TABLE t1;
#
# Bug#12763207 - ASSERT IN SUBSELECT::SINGLE_VALUE_TRANSFORMER
#
CREATE TABLE t1(a1 int);
INSERT INTO t1 VALUES (1),(2);
CREATE TABLE t2(a1 int);
INSERT INTO t2 VALUES (3);
SELECT @@session.sql_mode INTO @old_sql_mode;
SET SESSION sql_mode='ONLY_FULL_GROUP_BY';
SELECT 1 FROM t1 WHERE 1 < SOME (SELECT 2 FROM t2);
1
1
1
SELECT 1 FROM t1 WHERE 1 < SOME (SELECT 2.0 FROM t2);
1
1
1
SELECT 1 FROM t1 WHERE 1 < SOME (SELECT 'a' FROM t2);
1
SELECT 1 FROM t1 WHERE 1 < SOME (SELECT a1 FROM t2);
1
1
1
SET SESSION sql_mode=@old_sql_mode;
DROP TABLE t1, t2;
#
# Bug#12763207 - ASSERT IN SUBSELECT::SINGLE_VALUE_TRANSFORMER
#
create table t2(i int);
insert into t2 values(0);
SELECT @@session.sql_mode INTO @old_sql_mode;
SET SESSION sql_mode='ONLY_FULL_GROUP_BY';
CREATE VIEW v1 AS
SELECT 'f' FROM t2 UNION SELECT 'x' FROM t2
;
CREATE TABLE t1 (
pk int NOT NULL,
col_varchar_key varchar(1) DEFAULT NULL,
PRIMARY KEY (pk),
KEY col_varchar_key (col_varchar_key)
);
SELECT t1.pk
FROM t1
WHERE t1.col_varchar_key < ALL ( SELECT * FROM v1 )
;
pk
SET SESSION sql_mode=@old_sql_mode;
drop table t2, t1;
drop view v1;
End of 5.0 tests.
End of 5.0 tests.
CREATE TABLE t1 (a INT, b INT);
CREATE TABLE t1 (a INT, b INT);
INSERT INTO t1 VALUES (2,22),(1,11),(2,22);
INSERT INTO t1 VALUES (2,22),(1,11),(2,22);
...
...
mysql-test/t/subselect.test
View file @
efc29bc5
...
@@ -3427,6 +3427,61 @@ SET SESSION sql_mode=@old_sql_mode;
...
@@ -3427,6 +3427,61 @@ SET SESSION sql_mode=@old_sql_mode;
DEALLOCATE
PREPARE
stmt
;
DEALLOCATE
PREPARE
stmt
;
DROP
TABLE
t1
;
DROP
TABLE
t1
;
--
echo
#
--
echo
# Bug#12763207 - ASSERT IN SUBSELECT::SINGLE_VALUE_TRANSFORMER
--
echo
#
CREATE
TABLE
t1
(
a1
int
);
INSERT
INTO
t1
VALUES
(
1
),(
2
);
CREATE
TABLE
t2
(
a1
int
);
INSERT
INTO
t2
VALUES
(
3
);
SELECT
@@
session
.
sql_mode
INTO
@
old_sql_mode
;
SET
SESSION
sql_mode
=
'ONLY_FULL_GROUP_BY'
;
## All these are subject to the transformation
## '1 < some (...)' => '1 < max(...)'
SELECT
1
FROM
t1
WHERE
1
<
SOME
(
SELECT
2
FROM
t2
);
SELECT
1
FROM
t1
WHERE
1
<
SOME
(
SELECT
2.0
FROM
t2
);
SELECT
1
FROM
t1
WHERE
1
<
SOME
(
SELECT
'a'
FROM
t2
);
SELECT
1
FROM
t1
WHERE
1
<
SOME
(
SELECT
a1
FROM
t2
);
SET
SESSION
sql_mode
=@
old_sql_mode
;
DROP
TABLE
t1
,
t2
;
--
echo
#
--
echo
# Bug#12763207 - ASSERT IN SUBSELECT::SINGLE_VALUE_TRANSFORMER
--
echo
#
create
table
t2
(
i
int
);
insert
into
t2
values
(
0
);
SELECT
@@
session
.
sql_mode
INTO
@
old_sql_mode
;
SET
SESSION
sql_mode
=
'ONLY_FULL_GROUP_BY'
;
CREATE
VIEW
v1
AS
SELECT
'f'
FROM
t2
UNION
SELECT
'x'
FROM
t2
;
CREATE
TABLE
t1
(
pk
int
NOT
NULL
,
col_varchar_key
varchar
(
1
)
DEFAULT
NULL
,
PRIMARY
KEY
(
pk
),
KEY
col_varchar_key
(
col_varchar_key
)
);
SELECT
t1
.
pk
FROM
t1
WHERE
t1
.
col_varchar_key
<
ALL
(
SELECT
*
FROM
v1
)
;
SET
SESSION
sql_mode
=@
old_sql_mode
;
drop
table
t2
,
t1
;
drop
view
v1
;
--
echo
End
of
5.0
tests
.
--
echo
End
of
5.0
tests
.
#
#
...
...
sql/item_subselect.cc
View file @
efc29bc5
...
@@ -1020,7 +1020,13 @@ Item_in_subselect::single_value_transformer(JOIN *join,
...
@@ -1020,7 +1020,13 @@ Item_in_subselect::single_value_transformer(JOIN *join,
print_where
(
item
,
"rewrite with MIN/MAX"
,
QT_ORDINARY
););
print_where
(
item
,
"rewrite with MIN/MAX"
,
QT_ORDINARY
););
if
(
thd
->
variables
.
sql_mode
&
MODE_ONLY_FULL_GROUP_BY
)
if
(
thd
->
variables
.
sql_mode
&
MODE_ONLY_FULL_GROUP_BY
)
{
{
DBUG_ASSERT
(
select_lex
->
non_agg_field_used
());
/*
If the argument is a field, we assume that fix_fields() has
tagged the select_lex with non_agg_field_used.
We reverse that decision after this rewrite with MIN/MAX.
*/
if
(
item
->
get_arg
(
0
)
->
type
()
==
Item
::
FIELD_ITEM
)
DBUG_ASSERT
(
select_lex
->
non_agg_field_used
());
select_lex
->
set_non_agg_field_used
(
false
);
select_lex
->
set_non_agg_field_used
(
false
);
}
}
...
...
sql/table.cc
View file @
efc29bc5
...
@@ -3979,6 +3979,7 @@ Item *Field_iterator_table::create_item(THD *thd)
...
@@ -3979,6 +3979,7 @@ Item *Field_iterator_table::create_item(THD *thd)
{
{
select
->
non_agg_fields
.
push_back
(
item
);
select
->
non_agg_fields
.
push_back
(
item
);
item
->
marker
=
select
->
cur_pos_in_select_list
;
item
->
marker
=
select
->
cur_pos_in_select_list
;
select
->
set_non_agg_field_used
(
true
);
}
}
return
item
;
return
item
;
}
}
...
...
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