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
d21189d7
Commit
d21189d7
authored
Jan 10, 2012
by
Sergey Petrunya
Browse files
Options
Browse Files
Download
Plain Diff
Merge fix for BUG#912510
parents
a148cf7f
0b590282
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
84 additions
and
1 deletion
+84
-1
mysql-test/r/subselect_sj.result
mysql-test/r/subselect_sj.result
+17
-0
mysql-test/r/subselect_sj_jcl6.result
mysql-test/r/subselect_sj_jcl6.result
+17
-0
mysql-test/t/subselect_sj.test
mysql-test/t/subselect_sj.test
+19
-0
sql/field_conv.cc
sql/field_conv.cc
+28
-1
sql/sql_select.cc
sql/sql_select.cc
+3
-0
No files found.
mysql-test/r/subselect_sj.result
View file @
d21189d7
...
...
@@ -2152,4 +2152,21 @@ c c
set optimizer_prune_level= @opl_901399;
set optimizer_switch= @os_091399;
DROP TABLE t1,t2;
#
# BUG#912510: Crash in do_copy_not_null with semijoin=ON, firstmatch=ON, aggregate ...
#
CREATE TABLE t1 ( a VARCHAR(1) NOT NULL );
INSERT INTO t1 VALUES ('k'),('l');
CREATE TABLE t2 ( b VARCHAR(1) NOT NULL, KEY(b) );
INSERT INTO t2 VALUES ('k'),('l');
CREATE TABLE t3 ( c VARCHAR(1) NOT NULL, KEY(c) );
INSERT INTO t3 VALUES ('m'),('n');
SELECT a, COUNT(*) FROM t1
WHERE a IN (
SELECT b FROM t2 force index(b), t3 force index(c)
WHERE c = b AND b = a
);
a COUNT(*)
NULL 0
DROP TABLE t1, t2, t3;
set optimizer_switch=@subselect_sj_tmp;
mysql-test/r/subselect_sj_jcl6.result
View file @
d21189d7
...
...
@@ -2166,6 +2166,23 @@ c c
set optimizer_prune_level= @opl_901399;
set optimizer_switch= @os_091399;
DROP TABLE t1,t2;
#
# BUG#912510: Crash in do_copy_not_null with semijoin=ON, firstmatch=ON, aggregate ...
#
CREATE TABLE t1 ( a VARCHAR(1) NOT NULL );
INSERT INTO t1 VALUES ('k'),('l');
CREATE TABLE t2 ( b VARCHAR(1) NOT NULL, KEY(b) );
INSERT INTO t2 VALUES ('k'),('l');
CREATE TABLE t3 ( c VARCHAR(1) NOT NULL, KEY(c) );
INSERT INTO t3 VALUES ('m'),('n');
SELECT a, COUNT(*) FROM t1
WHERE a IN (
SELECT b FROM t2 force index(b), t3 force index(c)
WHERE c = b AND b = a
);
a COUNT(*)
NULL 0
DROP TABLE t1, t2, t3;
set optimizer_switch=@subselect_sj_tmp;
#
# BUG#49129: Wrong result with IN-subquery with join_cache_level=6 and firstmatch=off
...
...
mysql-test/t/subselect_sj.test
View file @
d21189d7
...
...
@@ -1997,6 +1997,25 @@ set optimizer_switch= @os_091399;
DROP
TABLE
t1
,
t2
;
--
echo
#
--
echo
# BUG#912510: Crash in do_copy_not_null with semijoin=ON, firstmatch=ON, aggregate ...
--
echo
#
CREATE
TABLE
t1
(
a
VARCHAR
(
1
)
NOT
NULL
);
INSERT
INTO
t1
VALUES
(
'k'
),(
'l'
);
CREATE
TABLE
t2
(
b
VARCHAR
(
1
)
NOT
NULL
,
KEY
(
b
)
);
INSERT
INTO
t2
VALUES
(
'k'
),(
'l'
);
CREATE
TABLE
t3
(
c
VARCHAR
(
1
)
NOT
NULL
,
KEY
(
c
)
);
INSERT
INTO
t3
VALUES
(
'm'
),(
'n'
);
SELECT
a
,
COUNT
(
*
)
FROM
t1
WHERE
a
IN
(
SELECT
b
FROM
t2
force
index
(
b
),
t3
force
index
(
c
)
WHERE
c
=
b
AND
b
=
a
);
DROP
TABLE
t1
,
t2
,
t3
;
# The following command must be the last one the file
set
optimizer_switch
=@
subselect_sj_tmp
;
sql/field_conv.cc
View file @
d21189d7
...
...
@@ -248,6 +248,25 @@ static void do_outer_field_null(Copy_field *copy)
}
}
/*
Copy: (not-NULL field in table that can be NULL-complemented) -> (not-NULL
field)
*/
static
void
do_copy_nullable_row_to_notnull
(
Copy_field
*
copy
)
{
if
(
*
copy
->
null_row
||
(
copy
->
from_null_ptr
&&
(
*
copy
->
from_null_ptr
&
copy
->
from_bit
)))
{
copy
->
to_field
->
set_warning
(
MYSQL_ERROR
::
WARN_LEVEL_WARN
,
WARN_DATA_TRUNCATED
,
1
);
copy
->
to_field
->
reset
();
}
else
{
(
copy
->
do_copy2
)(
copy
);
}
}
/* Copy: (NULL-able field) -> (not NULL-able field) */
static
void
do_copy_not_null
(
Copy_field
*
copy
)
...
...
@@ -638,7 +657,15 @@ void Copy_field::set(Field *to,Field *from,bool save)
else
if
(
to_field
==
to_field
->
table
->
next_number_field
)
do_copy
=
do_copy_next_number
;
else
do_copy
=
do_copy_not_null
;
{
if
(
!
from_null_ptr
)
{
null_row
=
&
from
->
table
->
null_row
;
do_copy
=
do_copy_nullable_row_to_notnull
;
}
else
do_copy
=
do_copy_not_null
;
}
}
}
else
if
(
to_field
->
real_maybe_null
())
...
...
sql/sql_select.cc
View file @
d21189d7
...
...
@@ -646,6 +646,9 @@ JOIN::prepare(Item ***rref_pointer_array,
aggregate functions and non-aggregate fields, any non-aggregated field
may produce a NULL value. Set all fields of each table as nullable before
semantic analysis to take into account this change of nullability.
Note: this loop doesn't touch tables inside merged semi-joins, because
subquery-to-semijoin conversion has not been done yet. This is intended.
*/
if
(
mixed_implicit_grouping
)
tbl
->
table
->
maybe_null
=
1
;
...
...
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