1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-29 00:08:14 +03:00
Files
mariadb/mysql-test/suite/pbxt/t/pbxt_updates.test
2009-04-02 12:03:14 +02:00

112 lines
2.5 KiB
Plaintext

# Test in-place updates
--disable_warnings
drop table if exists t1, t2;
--enable_warnings
CREATE TABLE t1
(
id INT PRIMARY KEY,
number INT,
string VARCHAR(20),
UNIQUE INDEX (number)
) ENGINE=pbxt;
truncate table t1;
insert t1 values (1, 1, 'abc');
begin;
update t1 set string = 'def' where id = 1;
update t1 set string = 'HIJ' where id = 1;
select * from t1 where id = 1;
select * from t1 where number = 1;
update t1 set string = '123', number=2 where id = 1;
select * from t1 where id = 1;
select * from t1 where number = 2;
commit;
-- error 1062
insert t1 values (2, 2, 'abc');
insert t1 values (2, 3, 'abc');
select * from t1 order by id;
begin;
update t1 set number = 1 where id = 1;
select * from t1 order by id;
-- error 1062
update t1 set number = 3 where id = 1;
select * from t1 where id = 1;
select * from t1 where id = 2;
select * from t1 where number = 1;
select * from t1 where number = 3;
select * from t1 order by id;
commit;
select * from t1 order by id;
drop table t1;
CREATE TABLE t1
(
id INT PRIMARY KEY,
number INT,
string VARCHAR(300),
UNIQUE INDEX (number)
) ENGINE=pbxt;
truncate table t1;
insert t1 values (1, 1, 'abc01234567890123456789012345678901234567890123456789$$$');
begin;
update t1 set string = 'def01234567890123456789012345678901234567890123456789---' where id = 1;
update t1 set string = 'HIJ01234567890123456789012345678901234567890123456789***' where id = 1;
select * from t1 where id = 1;
select * from t1 where number = 1;
update t1 set string = '12301234567890123456789012345678901234567890123456789+++', number=2 where id = 1;
select * from t1 where id = 1;
select * from t1 where number = 2;
commit;
-- error 1062
insert t1 values (2, 2, 'abc01234567890123456789012345678901234567890123456789===');
insert t1 values (2, 3, 'abc01234567890123456789012345678901234567890123456789+++');
select * from t1 order by id;
begin;
update t1 set number = 1 where id = 1;
select * from t1 order by id;
-- error 1062
update t1 set number = 3 where id = 1;
select * from t1 where id = 1;
select * from t1 where id = 2;
select * from t1 where number = 1;
select * from t1 where number = 3;
select * from t1 order by id;
rollback;
select * from t1 order by id;
drop table t1;
# insert + update in the same trx that changed record type caused a problem
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 ( id int, name varchar(300)) engine=pbxt;
begin;
insert t1(id, name) values(1, "aaa");
update t1 set name=REPEAT('A', 300) where id = 1;
commit;
select * from t1;
drop table t1;
--disable_query_log
drop database pbxt;
--enable_query_log