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
7e365efa
Commit
7e365efa
authored
Mar 11, 2008
by
kaa@kaamos.(none)
Browse files
Options
Browse Files
Download
Plain Diff
Merge kaamos.(none):/data/src/opt/mysql-5.0-opt
into kaamos.(none):/data/src/opt/mysql-5.1-opt
parents
e0851650
3a87bbfe
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
66 additions
and
4 deletions
+66
-4
mysql-test/r/null_key.result
mysql-test/r/null_key.result
+18
-0
mysql-test/t/null_key.test
mysql-test/t/null_key.test
+23
-0
sql/sql_select.cc
sql/sql_select.cc
+25
-4
No files found.
mysql-test/r/null_key.result
View file @
7e365efa
...
...
@@ -429,3 +429,21 @@ Handler_read_prev 0
Handler_read_rnd 0
Handler_read_rnd_next 5
DROP TABLE t1,t2,t3,t4;
CREATE TABLE t1 (
a int(11) default NULL,
b int(11) default NULL,
KEY a (a,b)
);
INSERT INTO t1 VALUES (0,10),(0,11),(0,12);
CREATE TABLE t2 (
a int(11) default NULL,
b int(11) default NULL,
KEY a (a)
);
INSERT INTO t2 VALUES (3,NULL),(3,11),(3,12);
SELECT * FROM t2 inner join t1 WHERE ( t1.a = 0 OR t1.a IS NULL) AND t2.a = 3 AND t2.b = t1.b;
a b a b
3 11 0 11
3 12 0 12
drop table t1, t2;
End of 5.0 tests
mysql-test/t/null_key.test
View file @
7e365efa
...
...
@@ -240,3 +240,26 @@ SHOW STATUS LIKE "handler_read%";
DROP
TABLE
t1
,
t2
,
t3
,
t4
;
# End of 4.1 tests
#
# BUG#34945 "ref_or_null queries that are null_rejecting and have a null value crash mysql"
#
CREATE
TABLE
t1
(
a
int
(
11
)
default
NULL
,
b
int
(
11
)
default
NULL
,
KEY
a
(
a
,
b
)
);
INSERT
INTO
t1
VALUES
(
0
,
10
),(
0
,
11
),(
0
,
12
);
CREATE
TABLE
t2
(
a
int
(
11
)
default
NULL
,
b
int
(
11
)
default
NULL
,
KEY
a
(
a
)
);
INSERT
INTO
t2
VALUES
(
3
,
NULL
),(
3
,
11
),(
3
,
12
);
SELECT
*
FROM
t2
inner
join
t1
WHERE
(
t1
.
a
=
0
OR
t1
.
a
IS
NULL
)
AND
t2
.
a
=
3
AND
t2
.
b
=
t1
.
b
;
drop
table
t1
,
t2
;
--
echo
End
of
5.0
tests
sql/sql_select.cc
View file @
7e365efa
...
...
@@ -11563,21 +11563,42 @@ join_read_key(JOIN_TAB *tab)
}
/*
ref access method implementation: "read_first" function
SYNOPSIS
join_read_always_key()
tab JOIN_TAB of the accessed table
DESCRIPTION
This is "read_fist" function for the "ref" access method.
The functon must leave the index initialized when it returns.
ref_or_null access implementation depends on that.
RETURN
0 - Ok
-1 - Row not found
1 - Error
*/
static
int
join_read_always_key
(
JOIN_TAB
*
tab
)
{
int
error
;
TABLE
*
table
=
tab
->
table
;
/* Initialize the index first */
if
(
!
table
->
file
->
inited
)
table
->
file
->
ha_index_init
(
tab
->
ref
.
key
,
tab
->
sorted
);
/* Perform "Late NULLs Filtering" (see internals manual for explanations) */
for
(
uint
i
=
0
;
i
<
tab
->
ref
.
key_parts
;
i
++
)
{
if
((
tab
->
ref
.
null_rejecting
&
1
<<
i
)
&&
tab
->
ref
.
items
[
i
]
->
is_null
())
return
-
1
;
}
if
(
!
table
->
file
->
inited
)
{
table
->
file
->
ha_index_init
(
tab
->
ref
.
key
,
tab
->
sorted
);
}
if
(
cp_buffer_from_ref
(
tab
->
join
->
thd
,
table
,
&
tab
->
ref
))
return
-
1
;
if
((
error
=
table
->
file
->
index_read_map
(
table
->
record
[
0
],
...
...
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