mirror of
https://github.com/MariaDB/server.git
synced 2025-01-17 12:32:27 +01:00
daac922bc3
BitKeeper/etc/ignore: auto-union BitKeeper/etc/logging_ok: auto-union BUILD/SETUP.sh: Auto merged BitKeeper/deleted/.del-libmysql.def~29fc6d70335f1c4c: Auto merged Makefile.am: Auto merged acinclude.m4: Auto merged BitKeeper/triggers/post-commit: Auto merged Build-tools/Do-compile: Auto merged VC++Files/libmysql/libmysql.dsp: Auto merged VC++Files/mysql.dsw: Auto merged client/mysql.cc: Auto merged client/mysqlbinlog.cc: Auto merged client/mysqldump.c: Auto merged include/config-win.h: Auto merged include/my_base.h: Auto merged include/my_global.h: Auto merged include/my_pthread.h: Auto merged include/my_sys.h: Auto merged include/violite.h: Auto merged innobase/buf/buf0flu.c: Auto merged innobase/buf/buf0lru.c: Auto merged innobase/include/buf0buf.h: Auto merged innobase/include/buf0lru.h: Auto merged innobase/include/row0mysql.h: Auto merged innobase/include/srv0srv.h: Auto merged innobase/lock/lock0lock.c: Auto merged innobase/log/log0log.c: Auto merged innobase/log/log0recv.c: Auto merged innobase/os/os0file.c: Auto merged innobase/row/row0mysql.c: Auto merged innobase/row/row0sel.c: Auto merged innobase/srv/srv0srv.c: Auto merged innobase/srv/srv0start.c: Auto merged innobase/trx/trx0sys.c: Auto merged innobase/trx/trx0trx.c: Auto merged innobase/ut/ut0ut.c: Auto merged myisam/ft_boolean_search.c: Auto merged myisam/mi_check.c: Auto merged myisam/mi_key.c: Auto merged myisam/mi_open.c: Auto merged myisam/mi_range.c: Auto merged myisam/mi_search.c: Auto merged myisam/sort.c: Auto merged mysql-test/r/delete.result: Auto merged mysql-test/r/fulltext.result: Auto merged mysql-test/r/innodb_handler.result: Auto merged mysql-test/r/join.result: Auto merged mysql-test/r/join_outer.result: Auto merged mysql-test/r/key.result: Auto merged mysql-test/r/multi_update.result: Auto merged mysql-test/r/myisam.result: Auto merged mysql-test/r/query_cache.result: Auto merged mysql-test/r/select.result: Auto merged mysql-test/r/variables.result: Auto merged mysql-test/t/alter_table.test: Auto merged mysql-test/t/ctype_latin1_de.test: Auto merged mysql-test/t/delete.test: Auto merged mysql-test/t/fulltext.test: Auto merged mysql-test/t/innodb_handler.test: Auto merged mysql-test/t/join.test: Auto merged mysql-test/t/join_outer.test: Auto merged mysql-test/t/key.test: Auto merged mysql-test/t/multi_update.test: Auto merged mysql-test/t/myisam.test: Auto merged mysql-test/t/query_cache.test: Auto merged mysql-test/t/repair.test: Auto merged mysql-test/t/select_safe.test: Auto merged mysql-test/t/type_decimal.test: Auto merged mysql-test/t/variables.test: Auto merged mysys/default.c: Auto merged mysys/my_pthread.c: Auto merged scripts/mysql_fix_privilege_tables.sh: Auto merged scripts/mysqld_safe.sh: Auto merged sql/ha_heap.h: Auto merged sql/ha_innodb.h: Auto merged sql/ha_myisam.cc: Auto merged sql/handler.cc: Auto merged sql/handler.h: Auto merged sql/init.cc: Auto merged sql/item.cc: Auto merged sql/item_create.cc: Auto merged sql/item_strfunc.cc: Auto merged sql/item_sum.cc: Auto merged sql/mini_client.cc: Auto merged sql/net_serv.cc: Auto merged sql/opt_range.cc: Auto merged sql/records.cc: Auto merged sql/slave.cc: Auto merged sql/sql_acl.h: Auto merged sql/sql_analyse.cc: Auto merged sql/sql_class.cc: Auto merged sql/sql_class.h: Auto merged sql/sql_list.h: Auto merged sql/sql_load.cc: Auto merged sql/share/czech/errmsg.txt: Auto merged sql/share/danish/errmsg.txt: Auto merged sql/share/dutch/errmsg.txt: Auto merged sql/share/english/errmsg.txt: Auto merged sql/share/estonian/errmsg.txt: Auto merged sql/share/french/errmsg.txt: Auto merged sql/share/greek/errmsg.txt: Auto merged sql/share/hungarian/errmsg.txt: Auto merged sql/share/italian/errmsg.txt: Auto merged sql/share/japanese/errmsg.txt: Auto merged sql/share/korean/errmsg.txt: Auto merged sql/share/norwegian-ny/errmsg.txt: Auto merged sql/share/norwegian/errmsg.txt: Auto merged sql/share/portuguese/errmsg.txt: Auto merged sql/share/romanian/errmsg.txt: Auto merged sql/share/russian/errmsg.txt: Auto merged sql/share/slovak/errmsg.txt: Auto merged sql/share/spanish/errmsg.txt: Auto merged sql/share/swedish/errmsg.txt: Auto merged sql/share/ukrainian/errmsg.txt: Auto merged sql/unireg.h: Auto merged sql-bench/crash-me.sh: Auto merged sql-bench/test-transactions.sh: Auto merged strings/ctype-tis620.c: Auto merged tests/grant.res: Auto merged sql/log_event.cc: Merge with 4.0.13 Cleaned up comment syntax
131 lines
4.2 KiB
Text
131 lines
4.2 KiB
Text
#
|
|
# test of updating of keys
|
|
#
|
|
|
|
--disable_warnings
|
|
drop table if exists t1,t2;
|
|
--enable_warnings
|
|
|
|
create table t1 (a int auto_increment , primary key (a));
|
|
insert into t1 values (NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL);
|
|
update t1 set a=a+10 where a > 34;
|
|
update t1 set a=a+100 where a > 0;
|
|
|
|
# Some strange updates to test some otherwise unused code
|
|
update t1 set a=a+100 where a=1 and a=2;
|
|
--error 1054
|
|
update t1 set a=b+100 where a=1 and a=2;
|
|
--error 1054
|
|
update t1 set a=b+100 where c=1 and a=2;
|
|
--error 1054
|
|
update t1 set d=a+100 where a=1;
|
|
select * from t1;
|
|
drop table t1;
|
|
|
|
CREATE TABLE t1
|
|
(
|
|
place_id int (10) unsigned NOT NULL,
|
|
shows int(10) unsigned DEFAULT '0' NOT NULL,
|
|
ishows int(10) unsigned DEFAULT '0' NOT NULL,
|
|
ushows int(10) unsigned DEFAULT '0' NOT NULL,
|
|
clicks int(10) unsigned DEFAULT '0' NOT NULL,
|
|
iclicks int(10) unsigned DEFAULT '0' NOT NULL,
|
|
uclicks int(10) unsigned DEFAULT '0' NOT NULL,
|
|
ts timestamp(14),
|
|
PRIMARY KEY (place_id,ts)
|
|
);
|
|
|
|
INSERT INTO t1 (place_id,shows,ishows,ushows,clicks,iclicks,uclicks,ts)
|
|
VALUES (1,0,0,0,0,0,0,20000928174434);
|
|
UPDATE t1 SET shows=shows+1,ishows=ishows+1,ushows=ushows+1,clicks=clicks+1,iclicks=iclicks+1,uclicks=uclicks+1 WHERE place_id=1 AND ts>="2000-09-28 00:00:00";
|
|
select place_id,shows from t1;
|
|
drop table t1;
|
|
|
|
#
|
|
# Test bug with update reported by Jan Legenhausen
|
|
#
|
|
|
|
CREATE TABLE t1 (
|
|
lfdnr int(10) unsigned NOT NULL default '0',
|
|
ticket int(10) unsigned NOT NULL default '0',
|
|
client varchar(255) NOT NULL default '',
|
|
replyto varchar(255) NOT NULL default '',
|
|
subject varchar(100) NOT NULL default '',
|
|
timestamp int(10) unsigned NOT NULL default '0',
|
|
tstamp timestamp(14) NOT NULL,
|
|
status int(3) NOT NULL default '0',
|
|
type varchar(15) NOT NULL default '',
|
|
assignment int(10) unsigned NOT NULL default '0',
|
|
fupcount int(4) unsigned NOT NULL default '0',
|
|
parent int(10) unsigned NOT NULL default '0',
|
|
activity int(10) unsigned NOT NULL default '0',
|
|
priority tinyint(1) unsigned NOT NULL default '1',
|
|
cc varchar(255) NOT NULL default '',
|
|
bcc varchar(255) NOT NULL default '',
|
|
body text NOT NULL,
|
|
comment text,
|
|
header text,
|
|
PRIMARY KEY (lfdnr),
|
|
KEY k1 (timestamp),
|
|
KEY k2 (type),
|
|
KEY k3 (parent),
|
|
KEY k4 (assignment),
|
|
KEY ticket (ticket)
|
|
) TYPE=MyISAM;
|
|
|
|
INSERT INTO t1 VALUES (773,773,'','','',980257344,20010318180652,0,'Open',10,0,0,0,1,'','','','','');
|
|
|
|
alter table t1 change lfdnr lfdnr int(10) unsigned not null auto_increment;
|
|
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, key (a));
|
|
insert into t1 values (1,1),(1,2),(1,3),(3,1),(3,2),(3,3),(3,1),(3,2),(3,3),(2,1),(2,2),(2,3);
|
|
SET @tmp=0;
|
|
update t1 set b=(@tmp:=@tmp+1) order by a;
|
|
update t1 set b=99 where a=1 order by b asc limit 1;
|
|
select * from t1 order by a,b;
|
|
update t1 set b=100 where a=1 order by b desc limit 2;
|
|
update t1 set a=a+10+b where a=1 order by b;
|
|
select * from t1 order by a,b;
|
|
create table t2 (a int not null, b int not null);
|
|
insert into t2 values (1,1),(1,2),(1,3);
|
|
update t1 set b=(select distinct 1 from (select * from t2) a);
|
|
drop table t1,t2;
|
|
|
|
#
|
|
# Test with limit (Bug #393)
|
|
#
|
|
|
|
CREATE TABLE t1 (
|
|
`id_param` smallint(3) unsigned NOT NULL default '0',
|
|
`nom_option` char(40) NOT NULL default '',
|
|
`valid` tinyint(1) NOT NULL default '0',
|
|
KEY `id_param` (`id_param`,`nom_option`)
|
|
) TYPE=MyISAM;
|
|
|
|
INSERT INTO t1 (id_param,nom_option,valid) VALUES (185,'600x1200',1);
|
|
|
|
UPDATE t1 SET nom_option='test' WHERE id_param=185 AND nom_option='600x1200' AND valid=1 LIMIT 1;
|
|
select * from t1;
|
|
drop table t1;
|
|
|
|
#
|
|
# Multi table update test from bugs
|
|
#
|
|
|
|
create table t1 (F1 VARCHAR(30), F2 VARCHAR(30), F3 VARCHAR(30), cnt int, groupid int, KEY groupid_index (groupid));
|
|
|
|
insert into t1 (F1,F2,F3,cnt,groupid) values ('0','0','0',1,6),
|
|
('0','1','2',1,5), ('0','2','0',1,3), ('1','0','1',1,2),
|
|
('1','2','1',1,1), ('1','2','2',1,1), ('2','0','1',2,4),
|
|
('2','2','0',1,7);
|
|
|
|
delete from t1 using t1 m1,t1 m2 where m1.groupid=m2.groupid and (m1.cnt < m2.cnt or m1.cnt=m2.cnt and m1.F3>m2.F3);
|
|
select * from t1;
|
|
drop table t1;
|