mirror of
https://github.com/MariaDB/server.git
synced 2025-01-18 04:53:01 +01:00
7e92336b1d
mysql_server_init() now returns error code if something went wrong (Bug #2062) Don't use my_fopen() when reading symlink information as this may cause problems when a lot of files are opened. Free thread keys with pthread_key_delete() instead of relying on automatic free. (Bug #2062) Fixed bug in UNION statement with alias '*'. (Bug #1249) Fixed a bug in DELETE ... ORDER BY ... LIMIT where the rows where not deleted in the proper order. (Bug #1024). FOUND_ROWS() could return incorrect number of rows after a query with an impossible WHERE condition. HOW DATABASES doesn't anymore show .sym files (on windows) that doesn't point to a valid directory. (Bug #1385)
48 lines
1.1 KiB
Text
48 lines
1.1 KiB
Text
#
|
|
# Test of update and delete with limit
|
|
#
|
|
|
|
drop table if exists t1;
|
|
create table t1 (a int primary key, b int not null);
|
|
insert into t1 () values (); -- Testing default values
|
|
insert into t1 values (1,1),(2,1),(3,1);
|
|
update t1 set a=4 where b=1 limit 1;
|
|
select * from t1;
|
|
update t1 set b=2 where b=1 limit 2;
|
|
select * from t1;
|
|
update t1 set b=4 where b=1;
|
|
select * from t1;
|
|
delete from t1 where b=2 limit 1;
|
|
select * from t1;
|
|
delete from t1 limit 1;
|
|
select * from t1;
|
|
drop table t1;
|
|
|
|
create table t1 (i int);
|
|
insert into t1 (i) values(1),(1),(1);
|
|
delete from t1 limit 1;
|
|
update t1 set i=2 limit 1;
|
|
delete from t1 limit 0;
|
|
update t1 set i=3 limit 0;
|
|
select * from t1;
|
|
drop table t1;
|
|
|
|
# LIMIT 0
|
|
|
|
select 0 limit 0;
|
|
|
|
#
|
|
# Test with DELETE, ORDER BY and limit (bug #1024)
|
|
#
|
|
|
|
CREATE TABLE t1(id int auto_increment primary key, id2 int, index(id2));
|
|
INSERT INTO t1 (id2) values (0),(0),(0);
|
|
DELETE FROM t1 WHERE id=1;
|
|
INSERT INTO t1 SET id2=0;
|
|
SELECT * FROM t1;
|
|
DELETE FROM t1 WHERE id2 = 0 ORDER BY id LIMIT 1;
|
|
# should have deleted WHERE id=2
|
|
SELECT * FROM t1;
|
|
DELETE FROM t1 WHERE id2 = 0 ORDER BY id desc LIMIT 1;
|
|
SELECT * FROM t1;
|
|
DROP TABLE t1;
|