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
47059b89
Commit
47059b89
authored
Nov 01, 2005
by
evgen@moonbone.local
Browse files
Options
Browse Files
Download
Plain Diff
Merge epotemkin@bk-internal.mysql.com:/home/bk/mysql-4.1
into moonbone.local:/work/14186-bug-4.1-mysql
parents
19502e8e
77723c24
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
31 additions
and
7 deletions
+31
-7
mysql-test/r/update.result
mysql-test/r/update.result
+8
-0
mysql-test/t/update.test
mysql-test/t/update.test
+9
-0
sql/sql_select.cc
sql/sql_select.cc
+1
-3
sql/sql_select.h
sql/sql_select.h
+1
-0
sql/sql_update.cc
sql/sql_update.cc
+12
-4
No files found.
mysql-test/r/update.result
View file @
47059b89
...
@@ -337,3 +337,11 @@ a b
...
@@ -337,3 +337,11 @@ a b
22 3
22 3
23 3
23 3
drop table t1;
drop table t1;
create table t1 (f1 date not null);
insert into t1 values('2000-01-01'),('0000-00-00');
update t1 set f1='2002-02-02' where f1 is null;
select * from t1;
f1
2000-01-01
2002-02-02
drop table t1;
mysql-test/t/update.test
View file @
47059b89
...
@@ -260,5 +260,14 @@ update t1 set a=a+11,b=2 order by a limit 3;
...
@@ -260,5 +260,14 @@ update t1 set a=a+11,b=2 order by a limit 3;
update
t1
set
a
=
a
+
12
,
b
=
3
order
by
a
limit
3
;
update
t1
set
a
=
a
+
12
,
b
=
3
order
by
a
limit
3
;
select
*
from
t1
order
by
a
;
select
*
from
t1
order
by
a
;
drop
table
t1
;
#
# Bug#14186 select datefield is null not updated
#
create
table
t1
(
f1
date
not
null
);
insert
into
t1
values
(
'2000-01-01'
),(
'0000-00-00'
);
update
t1
set
f1
=
'2002-02-02'
where
f1
is
null
;
select
*
from
t1
;
drop
table
t1
;
drop
table
t1
;
# End of 4.1 tests
# End of 4.1 tests
sql/sql_select.cc
View file @
47059b89
...
@@ -69,8 +69,6 @@ static int return_zero_rows(JOIN *join, select_result *res,TABLE_LIST *tables,
...
@@ -69,8 +69,6 @@ static int return_zero_rows(JOIN *join, select_result *res,TABLE_LIST *tables,
SELECT_LEX_UNIT
*
unit
);
SELECT_LEX_UNIT
*
unit
);
static
COND
*
optimize_cond
(
THD
*
thd
,
COND
*
conds
,
static
COND
*
optimize_cond
(
THD
*
thd
,
COND
*
conds
,
Item
::
cond_result
*
cond_value
);
Item
::
cond_result
*
cond_value
);
static
COND
*
remove_eq_conds
(
THD
*
thd
,
COND
*
cond
,
Item
::
cond_result
*
cond_value
);
static
bool
const_expression_in_where
(
COND
*
conds
,
Item
*
item
,
Item
**
comp_item
);
static
bool
const_expression_in_where
(
COND
*
conds
,
Item
*
item
,
Item
**
comp_item
);
static
bool
open_tmp_table
(
TABLE
*
table
);
static
bool
open_tmp_table
(
TABLE
*
table
);
static
bool
create_myisam_tmp_table
(
TABLE
*
table
,
TMP_TABLE_PARAM
*
param
,
static
bool
create_myisam_tmp_table
(
TABLE
*
table
,
TMP_TABLE_PARAM
*
param
,
...
@@ -4615,7 +4613,7 @@ optimize_cond(THD *thd, COND *conds, Item::cond_result *cond_value)
...
@@ -4615,7 +4613,7 @@ optimize_cond(THD *thd, COND *conds, Item::cond_result *cond_value)
COND_FALSE always false ( 1 = 2 )
COND_FALSE always false ( 1 = 2 )
*/
*/
static
COND
*
COND
*
remove_eq_conds
(
THD
*
thd
,
COND
*
cond
,
Item
::
cond_result
*
cond_value
)
remove_eq_conds
(
THD
*
thd
,
COND
*
cond
,
Item
::
cond_result
*
cond_value
)
{
{
if
(
cond
->
type
()
==
Item
::
COND_ITEM
)
if
(
cond
->
type
()
==
Item
::
COND_ITEM
)
...
...
sql/sql_select.h
View file @
47059b89
...
@@ -457,3 +457,4 @@ bool cp_buffer_from_ref(THD *thd, TABLE_REF *ref);
...
@@ -457,3 +457,4 @@ bool cp_buffer_from_ref(THD *thd, TABLE_REF *ref);
bool
error_if_full_join
(
JOIN
*
join
);
bool
error_if_full_join
(
JOIN
*
join
);
int
report_error
(
TABLE
*
table
,
int
error
);
int
report_error
(
TABLE
*
table
,
int
error
);
int
safe_index_read
(
JOIN_TAB
*
tab
);
int
safe_index_read
(
JOIN_TAB
*
tab
);
COND
*
remove_eq_conds
(
THD
*
thd
,
COND
*
cond
,
Item
::
cond_result
*
cond_value
);
sql/sql_update.cc
View file @
47059b89
...
@@ -70,7 +70,7 @@ int mysql_update(THD *thd,
...
@@ -70,7 +70,7 @@ int mysql_update(THD *thd,
ha_rows
updated
,
found
;
ha_rows
updated
,
found
;
key_map
old_used_keys
;
key_map
old_used_keys
;
TABLE
*
table
;
TABLE
*
table
;
SQL_SELECT
*
select
;
SQL_SELECT
*
select
=
0
;
READ_RECORD
info
;
READ_RECORD
info
;
TABLE_LIST
*
update_table_list
=
((
TABLE_LIST
*
)
TABLE_LIST
*
update_table_list
=
((
TABLE_LIST
*
)
thd
->
lex
->
select_lex
.
table_list
.
first
);
thd
->
lex
->
select_lex
.
table_list
.
first
);
...
@@ -131,11 +131,19 @@ int mysql_update(THD *thd,
...
@@ -131,11 +131,19 @@ int mysql_update(THD *thd,
DBUG_RETURN
(
-
1
);
/* purecov: inspected */
DBUG_RETURN
(
-
1
);
/* purecov: inspected */
}
}
if
(
conds
)
{
Item
::
cond_result
cond_value
;
conds
=
remove_eq_conds
(
thd
,
conds
,
&
cond_value
);
if
(
cond_value
==
Item
::
COND_FALSE
)
limit
=
0
;
// Impossible WHERE
}
// Don't count on usage of 'only index' when calculating which key to use
// Don't count on usage of 'only index' when calculating which key to use
table
->
used_keys
.
clear_all
();
table
->
used_keys
.
clear_all
();
select
=
make_select
(
table
,
0
,
0
,
conds
,
&
error
);
if
(
limit
)
if
(
error
||
select
=
make_select
(
table
,
0
,
0
,
conds
,
&
error
);
(
select
&&
select
->
check_quick
(
thd
,
safe_update
,
limit
))
||
!
limit
)
if
(
error
||
!
limit
||
(
select
&&
select
->
check_quick
(
thd
,
safe_update
,
limit
)))
{
{
delete
select
;
delete
select
;
free_underlaid_joins
(
thd
,
&
thd
->
lex
->
select_lex
);
free_underlaid_joins
(
thd
,
&
thd
->
lex
->
select_lex
);
...
...
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