mirror of
https://github.com/MariaDB/server.git
synced 2025-01-19 05:22:25 +01:00
Merge ibabaev@bk-internal.mysql.com:/home/bk/mysql-5.0-opt
into olga.mysql.com:/home/igor/mysql-5.0-opt
This commit is contained in:
commit
9f918b0190
3 changed files with 81 additions and 0 deletions
|
@ -1278,4 +1278,36 @@ a b
|
|||
2 b
|
||||
3 c
|
||||
drop table t1;
|
||||
CREATE TABLE t1 (
|
||||
id int NOT NULL DEFAULT '0',
|
||||
a varchar(10) NOT NULL,
|
||||
b varchar(10),
|
||||
c varchar(10),
|
||||
d timestamp NOT NULL,
|
||||
PRIMARY KEY (id, a)
|
||||
);
|
||||
CREATE TABLE t2 (
|
||||
fubar_id int unsigned NOT NULL DEFAULT '0',
|
||||
last_change_time datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
PRIMARY KEY (fubar_id)
|
||||
);
|
||||
CREATE TRIGGER fubar_change
|
||||
AFTER UPDATE ON t1
|
||||
FOR EACH ROW
|
||||
BEGIN
|
||||
INSERT INTO t2 (fubar_id, last_change_time)
|
||||
SELECT DISTINCT NEW.id AS fubar_id, NOW() AS last_change_time
|
||||
FROM t1 WHERE (id = NEW.id) AND (OLD.c != NEW.c)
|
||||
ON DUPLICATE KEY UPDATE
|
||||
last_change_time =
|
||||
IF((fubar_id = NEW.id)AND(OLD.c != NEW.c),NOW(),last_change_time);
|
||||
END
|
||||
|
|
||||
INSERT INTO t1 (id,a, b,c,d) VALUES
|
||||
(1,'a','b','c',now()),(2,'a','b','c',now());
|
||||
UPDATE t1 SET c='Bang!' WHERE id=1;
|
||||
SELECT fubar_id FROM t2;
|
||||
fubar_id
|
||||
1
|
||||
DROP TABLE t1,t2;
|
||||
End of 5.0 tests
|
||||
|
|
|
@ -1548,4 +1548,50 @@ select * from t1;
|
|||
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Bug#25398: crash when a trigger contains a SELECT with
|
||||
# trigger fields in the select list under DISTINCT
|
||||
#
|
||||
|
||||
CREATE TABLE t1 (
|
||||
id int NOT NULL DEFAULT '0',
|
||||
a varchar(10) NOT NULL,
|
||||
b varchar(10),
|
||||
c varchar(10),
|
||||
d timestamp NOT NULL,
|
||||
PRIMARY KEY (id, a)
|
||||
);
|
||||
|
||||
CREATE TABLE t2 (
|
||||
fubar_id int unsigned NOT NULL DEFAULT '0',
|
||||
last_change_time datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
PRIMARY KEY (fubar_id)
|
||||
);
|
||||
|
||||
DELIMITER |;
|
||||
|
||||
CREATE TRIGGER fubar_change
|
||||
AFTER UPDATE ON t1
|
||||
FOR EACH ROW
|
||||
BEGIN
|
||||
INSERT INTO t2 (fubar_id, last_change_time)
|
||||
SELECT DISTINCT NEW.id AS fubar_id, NOW() AS last_change_time
|
||||
FROM t1 WHERE (id = NEW.id) AND (OLD.c != NEW.c)
|
||||
ON DUPLICATE KEY UPDATE
|
||||
last_change_time =
|
||||
IF((fubar_id = NEW.id)AND(OLD.c != NEW.c),NOW(),last_change_time);
|
||||
END
|
||||
|
|
||||
|
||||
DELIMITER ;|
|
||||
|
||||
INSERT INTO t1 (id,a, b,c,d) VALUES
|
||||
(1,'a','b','c',now()),(2,'a','b','c',now());
|
||||
|
||||
UPDATE t1 SET c='Bang!' WHERE id=1;
|
||||
|
||||
SELECT fubar_id FROM t2;
|
||||
|
||||
DROP TABLE t1,t2;
|
||||
|
||||
--echo End of 5.0 tests
|
||||
|
|
|
@ -2269,6 +2269,9 @@ public:
|
|||
bool fix_fields(THD *, Item **);
|
||||
void print(String *str);
|
||||
table_map used_tables() const { return (table_map)0L; }
|
||||
Field *get_tmp_table_field() { return 0; }
|
||||
Item *copy_or_same(THD *thd) { return this; }
|
||||
Item *get_tmp_table_item(THD *thd) { return copy_or_same(thd); }
|
||||
void cleanup();
|
||||
|
||||
private:
|
||||
|
|
Loading…
Reference in a new issue