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
937241ad
Commit
937241ad
authored
Mar 07, 2003
by
monty@mashka.mysql.fi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed an unlikely optimizer bug that casued a core dump in pt_range.cc::sel_cmp()
parent
c6432989
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
38 additions
and
6 deletions
+38
-6
mysql-test/r/join.result
mysql-test/r/join.result
+4
-0
mysql-test/t/join.test
mysql-test/t/join.test
+24
-0
sql/opt_range.cc
sql/opt_range.cc
+8
-4
sql/sql_rename.cc
sql/sql_rename.cc
+2
-2
No files found.
mysql-test/r/join.result
View file @
937241ad
...
@@ -37,3 +37,7 @@ COUNT(t1.Title)
...
@@ -37,3 +37,7 @@ COUNT(t1.Title)
t1_id t2_id type cost_unit min_value max_value t3_id item_id id name
t1_id t2_id type cost_unit min_value max_value t3_id item_id id name
22 1 Percent Cost 100 -1 6 291 1 s1
22 1 Percent Cost 100 -1 6 291 1 s1
23 1 Percent Cost 100 -1 21 291 1 s1
23 1 Percent Cost 100 -1 21 291 1 s1
rate_code base_rate
cust 20
rate_code base_rate
cust 20
mysql-test/t/join.test
View file @
937241ad
...
@@ -219,3 +219,27 @@ CREATE TABLE t2 (
...
@@ -219,3 +219,27 @@ CREATE TABLE t2 (
INSERT
INTO
t2
VALUES
(
1
,
's1'
),(
2
,
's2'
),(
3
,
's3'
),(
4
,
's4'
),(
5
,
's5'
);
INSERT
INTO
t2
VALUES
(
1
,
's1'
),(
2
,
's2'
),(
3
,
's3'
),(
4
,
's4'
),(
5
,
's5'
);
select
t1
.*
,
t2
.*
from
t1
,
t2
where
t2
.
id
=
t1
.
t2_id
limit
2
;
select
t1
.*
,
t2
.*
from
t1
,
t2
where
t2
.
id
=
t1
.
t2_id
limit
2
;
drop
table
t1
,
t2
;
drop
table
t1
,
t2
;
#
# Bug in range optimiser with MAYBE_KEY
#
CREATE
TABLE
t1
(
siteid
varchar
(
25
)
NOT
NULL
default
''
,
emp_id
varchar
(
30
)
NOT
NULL
default
''
,
rate_code
varchar
(
10
)
default
NULL
,
UNIQUE
KEY
site_emp
(
siteid
,
emp_id
),
KEY
siteid
(
siteid
)
)
TYPE
=
MyISAM
;
INSERT
INTO
t1
VALUES
(
'rivercats'
,
'psmith'
,
'cust'
),
(
'rivercats'
,
'KWalker'
,
'cust'
);
CREATE
TABLE
t2
(
siteid
varchar
(
25
)
NOT
NULL
default
''
,
rate_code
varchar
(
10
)
NOT
NULL
default
''
,
base_rate
float
NOT
NULL
default
'0'
,
PRIMARY
KEY
(
siteid
,
rate_code
),
FULLTEXT
KEY
rate_code
(
rate_code
)
)
TYPE
=
MyISAM
;
INSERT
INTO
t2
VALUES
(
'rivercats'
,
'cust'
,
20
);
SELECT
emp
.
rate_code
,
lr
.
base_rate
FROM
t1
AS
emp
LEFT
JOIN
t2
AS
lr
USING
(
siteid
,
rate_code
)
WHERE
emp
.
emp_id
=
'psmith'
AND
lr
.
siteid
=
'rivercats'
;
SELECT
emp
.
rate_code
,
lr
.
base_rate
FROM
t1
AS
emp
LEFT
JOIN
t2
AS
lr
USING
(
siteid
,
rate_code
)
WHERE
lr
.
siteid
=
'rivercats'
AND
emp
.
emp_id
=
'psmith'
;
drop
table
t1
,
t2
;
sql/opt_range.cc
View file @
937241ad
...
@@ -1341,7 +1341,8 @@ key_and(SEL_ARG *key1,SEL_ARG *key2,uint clone_flag)
...
@@ -1341,7 +1341,8 @@ key_and(SEL_ARG *key1,SEL_ARG *key2,uint clone_flag)
}
}
if
(((
clone_flag
&
CLONE_KEY2_MAYBE
)
&&
if
(((
clone_flag
&
CLONE_KEY2_MAYBE
)
&&
!
(
clone_flag
&
CLONE_KEY1_MAYBE
))
||
!
(
clone_flag
&
CLONE_KEY1_MAYBE
)
&&
key2
->
type
!=
SEL_ARG
::
MAYBE_KEY
)
||
key1
->
type
==
SEL_ARG
::
MAYBE_KEY
)
key1
->
type
==
SEL_ARG
::
MAYBE_KEY
)
{
// Put simple key in key2
{
// Put simple key in key2
swap
(
SEL_ARG
*
,
key1
,
key2
);
swap
(
SEL_ARG
*
,
key1
,
key2
);
...
@@ -1369,7 +1370,10 @@ key_and(SEL_ARG *key1,SEL_ARG *key2,uint clone_flag)
...
@@ -1369,7 +1370,10 @@ key_and(SEL_ARG *key1,SEL_ARG *key2,uint clone_flag)
{
{
key1
->
maybe_smaller
();
key1
->
maybe_smaller
();
if
(
key2
->
next_key_part
)
if
(
key2
->
next_key_part
)
{
key1
->
use_count
--
;
// Incremented in and_all_keys
return
and_all_keys
(
key1
,
key2
,
clone_flag
);
return
and_all_keys
(
key1
,
key2
,
clone_flag
);
}
key2
->
use_count
--
;
// Key2 doesn't have a tree
key2
->
use_count
--
;
// Key2 doesn't have a tree
}
}
return
key1
;
return
key1
;
...
@@ -2068,7 +2072,7 @@ void SEL_ARG::test_use_count(SEL_ARG *root)
...
@@ -2068,7 +2072,7 @@ void SEL_ARG::test_use_count(SEL_ARG *root)
{
{
if
(
this
==
root
&&
use_count
!=
1
)
if
(
this
==
root
&&
use_count
!=
1
)
{
{
sql_print_error
(
"Use_count: Wrong count %lu for root"
,
use_count
);
sql_print_error
(
"
Note:
Use_count: Wrong count %lu for root"
,
use_count
);
return
;
return
;
}
}
if
(
this
->
type
!=
SEL_ARG
::
KEY_RANGE
)
if
(
this
->
type
!=
SEL_ARG
::
KEY_RANGE
)
...
@@ -2082,7 +2086,7 @@ void SEL_ARG::test_use_count(SEL_ARG *root)
...
@@ -2082,7 +2086,7 @@ void SEL_ARG::test_use_count(SEL_ARG *root)
ulong
count
=
count_key_part_usage
(
root
,
pos
->
next_key_part
);
ulong
count
=
count_key_part_usage
(
root
,
pos
->
next_key_part
);
if
(
count
>
pos
->
next_key_part
->
use_count
)
if
(
count
>
pos
->
next_key_part
->
use_count
)
{
{
sql_print_error
(
"Use_count: Wrong count for key at %lx, %lu should be %lu"
,
sql_print_error
(
"
Note:
Use_count: Wrong count for key at %lx, %lu should be %lu"
,
pos
,
pos
->
next_key_part
->
use_count
,
count
);
pos
,
pos
->
next_key_part
->
use_count
,
count
);
return
;
return
;
}
}
...
@@ -2090,7 +2094,7 @@ void SEL_ARG::test_use_count(SEL_ARG *root)
...
@@ -2090,7 +2094,7 @@ void SEL_ARG::test_use_count(SEL_ARG *root)
}
}
}
}
if
(
e_count
!=
elements
)
if
(
e_count
!=
elements
)
sql_print_error
(
"Wrong use count: %u for tree at %lx"
,
e_count
,
sql_print_error
(
"W
arning: W
rong use count: %u for tree at %lx"
,
e_count
,
(
gptr
)
this
);
(
gptr
)
this
);
}
}
...
...
sql/sql_rename.cc
View file @
937241ad
...
@@ -122,7 +122,7 @@ rename_tables(THD *thd, TABLE_LIST *table_list, bool skip_error)
...
@@ -122,7 +122,7 @@ rename_tables(THD *thd, TABLE_LIST *table_list, bool skip_error)
if
(
!
access
(
name
,
F_OK
))
if
(
!
access
(
name
,
F_OK
))
{
{
my_error
(
ER_TABLE_EXISTS_ERROR
,
MYF
(
0
),
name
);
my_error
(
ER_TABLE_EXISTS_ERROR
,
MYF
(
0
),
name
);
return
ren_table
;
// This can't be skipped
DBUG_RETURN
(
ren_table
);
// This can't be skipped
}
}
sprintf
(
name
,
"%s/%s/%s%s"
,
mysql_data_home
,
sprintf
(
name
,
"%s/%s/%s%s"
,
mysql_data_home
,
ren_table
->
db
,
ren_table
->
real_name
,
ren_table
->
db
,
ren_table
->
real_name
,
...
@@ -131,7 +131,7 @@ rename_tables(THD *thd, TABLE_LIST *table_list, bool skip_error)
...
@@ -131,7 +131,7 @@ rename_tables(THD *thd, TABLE_LIST *table_list, bool skip_error)
{
{
my_error
(
ER_FILE_NOT_FOUND
,
MYF
(
0
),
name
,
my_errno
);
my_error
(
ER_FILE_NOT_FOUND
,
MYF
(
0
),
name
,
my_errno
);
if
(
!
skip_error
)
if
(
!
skip_error
)
return
ren_table
;
DBUG_RETURN
(
ren_table
)
;
}
}
else
if
(
mysql_rename_table
(
table_type
,
else
if
(
mysql_rename_table
(
table_type
,
ren_table
->
db
,
ren_table
->
real_name
,
ren_table
->
db
,
ren_table
->
real_name
,
...
...
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