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
7a45e7f2
Commit
7a45e7f2
authored
Nov 08, 2001
by
monty@hundin.mysql.fi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed bug in UPDATE .. ORDER BY
parent
578ab3f1
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
28 additions
and
5 deletions
+28
-5
Docs/manual.texi
Docs/manual.texi
+2
-0
mysql-test/r/update.result
mysql-test/r/update.result
+10
-0
mysql-test/t/update.test
mysql-test/t/update.test
+11
-0
sql/sql_update.cc
sql/sql_update.cc
+1
-1
sql/sql_yacc.yy
sql/sql_yacc.yy
+4
-4
No files found.
Docs/manual.texi
View file @
7a45e7f2
...
...
@@ -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.
mysql-test/r/update.result
View file @
7a45e7f2
...
...
@@ -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;
mysql-test/t/update.test
View file @
7a45e7f2
...
...
@@ -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
;
sql/sql_update.cc
View file @
7a45e7f2
...
...
@@ -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
...
...
sql/sql_yacc.yy
View file @
7a45e7f2
...
...
@@ -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
...
...
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