mirror of
https://github.com/MariaDB/server.git
synced 2025-12-24 11:21:21 +03:00
merge with 4.0
This commit is contained in:
@@ -344,3 +344,40 @@ select 't2 rows after big delete', count(*) from t2;
|
||||
select 't1 rows after big delete', count(*) from t1;
|
||||
|
||||
drop table t1,t2;
|
||||
|
||||
#
|
||||
# Test alias (this is not correct in 4.0)
|
||||
#
|
||||
|
||||
CREATE TABLE t1 ( a int );
|
||||
CREATE TABLE t2 ( a int );
|
||||
DELETE t1 FROM t1, t2 AS t3;
|
||||
--error 1066
|
||||
DELETE t4 FROM t1, t1 AS t4;
|
||||
--error 1066
|
||||
DELETE t3 FROM t1 AS t3, t1 AS t4;
|
||||
#--error 1066
|
||||
DELETE t1 FROM t1 AS t3, t2 AS t4;
|
||||
INSERT INTO t1 values (1),(2);
|
||||
INSERT INTO t2 values (1),(2);
|
||||
DELETE t1 FROM t1 AS t2, t2 AS t1 where t1.a=t2.a and t1.a=1;
|
||||
SELECT * from t1;
|
||||
SELECT * from t2;
|
||||
DELETE t2 FROM t1 AS t2, t2 AS t1 where t1.a=t2.a and t1.a=2;
|
||||
SELECT * from t1;
|
||||
SELECT * from t2;
|
||||
DROP TABLE t1,t2;
|
||||
|
||||
#
|
||||
# Test update with const tables
|
||||
#
|
||||
|
||||
create table `t1` (`p_id` int(10) unsigned NOT NULL auto_increment, `p_code` varchar(20) NOT NULL default '', `p_active` tinyint(1) unsigned NOT NULL default '1', PRIMARY KEY (`p_id`) );
|
||||
create table `t2` (`c2_id` int(10) unsigned NULL auto_increment, `c2_p_id` int(10) unsigned NOT NULL default '0', `c2_note` text NOT NULL, `c2_active` tinyint(1) unsigned NOT NULL default '1', PRIMARY KEY (`c2_id`), KEY `c2_p_id` (`c2_p_id`) );
|
||||
insert into t1 values (0,'A01-Comp',1);
|
||||
insert into t1 values (0,'B01-Comp',1);
|
||||
insert into t2 values (0,1,'A Note',1);
|
||||
update t1 left join t2 on p_id = c2_p_id set c2_note = 'asdf-1' where p_id = 2;
|
||||
select * from t1;
|
||||
select * from t2;
|
||||
drop table t1, t2;
|
||||
|
||||
Reference in New Issue
Block a user