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
fab7f39e
Commit
fab7f39e
authored
Jan 20, 2003
by
monty@mashka.mysql.fi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed bug with EXPLAIN on empty table
parent
a5e30be0
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
37 additions
and
28 deletions
+37
-28
mysql-test/r/explain.result
mysql-test/r/explain.result
+3
-0
mysql-test/t/explain.test
mysql-test/t/explain.test
+5
-2
sql/sql_select.cc
sql/sql_select.cc
+29
-26
No files found.
mysql-test/r/explain.result
View file @
fab7f39e
drop table if exists t1;
create table t1 (id int not null, str char(10), unique(str));
explain select * from t1;
table type possible_keys key key_len ref rows Extra
t1 system NULL NULL NULL NULL 0 const row not found
insert into t1 values (1, null),(2, null),(3, "foo"),(4, "bar");
select * from t1 where str is null;
id str
...
...
mysql-test/t/explain.test
View file @
fab7f39e
...
...
@@ -3,6 +3,7 @@
drop
table
if
exists
t1
;
create
table
t1
(
id
int
not
null
,
str
char
(
10
),
unique
(
str
));
explain
select
*
from
t1
;
insert
into
t1
values
(
1
,
null
),(
2
,
null
),(
3
,
"foo"
),(
4
,
"bar"
);
select
*
from
t1
where
str
is
null
;
select
*
from
t1
where
str
=
"foo"
;
...
...
@@ -12,8 +13,10 @@ explain select * from t1 ignore key (str) where str="foo";
explain
select
*
from
t1
use
key
(str,str) where str="foo"
;
#The following should give errors
!
$
1072
explain
select
*
from
t1
use
key
(str,str,foo) where str="foo"
;
!
$
1072
explain
select
*
from
t1
ignore
key
(
str
,
str
,
foo
)
where
str
=
"foo"
;
--
error
1072
explain
select
*
from
t1
use
key
(str,str,foo) where str="foo"
;
--
error
1072
explain
select
*
from
t1
ignore
key
(
str
,
str
,
foo
)
where
str
=
"foo"
;
drop
table
t1
;
explain
select
1
;
sql/sql_select.cc
View file @
fab7f39e
...
...
@@ -7352,7 +7352,9 @@ static void select_describe(JOIN *join, bool need_tmp_table, bool need_order,
if
(
tab
->
info
)
item_list
.
push_back
(
new
Item_string
(
tab
->
info
,
strlen
(
tab
->
info
)));
else
if
(
tab
->
select
)
else
{
if
(
tab
->
select
)
{
if
(
tab
->
use_quick
==
2
)
{
...
...
@@ -7382,6 +7384,7 @@ static void select_describe(JOIN *join, bool need_tmp_table, bool need_order,
if
(
buff_ptr
==
buff
)
buff_ptr
+=
2
;
item_list
.
push_back
(
new
Item_string
(
buff
+
2
,(
uint
)
(
buff_ptr
-
buff
)
-
2
));
}
// For next iteration
used_tables
|=
table
->
map
;
if
(
result
->
send_data
(
item_list
))
...
...
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