mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Fixed bug in UPDATE .. ORDER BY
Docs/manual.texi: Changelog mysql-test/r/update.result: Test found bug in UPDATE .. ORDER BY mysql-test/t/update.test: Test found bug in UPDATE .. ORDER BY
This commit is contained in:
@ -46491,6 +46491,8 @@ Our TODO section contains what we plan to have in 4.0. @xref{TODO MySQL 4.0}.
|
||||
|
||||
@itemize @bullet
|
||||
@item
|
||||
Fixed core dump bug in @code{UPDATE ... ORDER BY }.
|
||||
@item
|
||||
Changed @code{INSERT INTO .. SELECT} to by default stop on errors.
|
||||
@item
|
||||
Ignore @code{DATA DIRECTORY} and @code{INDEX DIRECTORY} directives on windows.
|
||||
|
@ -102,3 +102,13 @@ select status from t1;
|
||||
status
|
||||
1
|
||||
drop table t1;
|
||||
create table t1 (a int not null, b int not null);
|
||||
insert into t1 values (1,1),(1,2),(1,3);
|
||||
update t1 set b=4 where a=1 order by b asc limit 1;
|
||||
update t1 set b=4 where a=1 order by b desc limit 1;
|
||||
select * from t1;
|
||||
a b
|
||||
1 4
|
||||
1 4
|
||||
1 2
|
||||
drop table t1;
|
||||
|
@ -76,3 +76,14 @@ alter table t1 change lfdnr lfdnr int(10) unsigned default 0 not null auto_incre
|
||||
update t1 set status=1 where type='Open';
|
||||
select status from t1;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Test of ORDER BY
|
||||
#
|
||||
|
||||
create table t1 (a int not null, b int not null);
|
||||
insert into t1 values (1,1),(1,2),(1,3);
|
||||
update t1 set b=4 where a=1 order by b asc limit 1;
|
||||
update t1 set b=4 where a=1 order by b desc limit 1;
|
||||
select * from t1;
|
||||
drop table t1;
|
||||
|
@ -148,7 +148,7 @@ int mysql_update(THD *thd,
|
||||
used_key_is_modified=check_if_key_used(table, used_index, fields);
|
||||
else
|
||||
used_key_is_modified=0;
|
||||
if (used_key_is_modified)
|
||||
if (used_key_is_modified || order)
|
||||
{
|
||||
/*
|
||||
** We can't update table directly; We must first search after all
|
||||
|
@ -2305,10 +2305,6 @@ values:
|
||||
|
||||
update:
|
||||
UPDATE_SYM opt_low_priority opt_ignore table_name
|
||||
SET update_list
|
||||
where_clause
|
||||
opt_order_clause
|
||||
delete_limit_clause
|
||||
{
|
||||
LEX *lex=Lex;
|
||||
lex->sql_command = SQLCOM_UPDATE;
|
||||
@ -2316,6 +2312,10 @@ update:
|
||||
lex->select->order_list.first=0;
|
||||
lex->select->order_list.next= (byte**) &lex->select->order_list.first;
|
||||
}
|
||||
SET update_list
|
||||
where_clause
|
||||
opt_order_clause
|
||||
delete_limit_clause
|
||||
|
||||
update_list:
|
||||
update_list ',' simple_ident equal expr
|
||||
|
Reference in New Issue
Block a user