diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-04 18:00:34 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-04 18:00:34 +0000 |
commit | 3f619478f796eddbba6e39502fe941b285dd97b1 (patch) | |
tree | e2c7b5777f728320e5b5542b6213fd3591ba51e2 /mysql-test/main/create_drop_trigger.result | |
parent | Initial commit. (diff) | |
download | mariadb-3f619478f796eddbba6e39502fe941b285dd97b1.tar.xz mariadb-3f619478f796eddbba6e39502fe941b285dd97b1.zip |
Adding upstream version 1:10.11.6.upstream/1%10.11.6upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'mysql-test/main/create_drop_trigger.result')
-rw-r--r-- | mysql-test/main/create_drop_trigger.result | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/mysql-test/main/create_drop_trigger.result b/mysql-test/main/create_drop_trigger.result new file mode 100644 index 00000000..d2857a0c --- /dev/null +++ b/mysql-test/main/create_drop_trigger.result @@ -0,0 +1,36 @@ +CREATE DATABASE db1; +USE db1; +CREATE TABLE t1 (val INT); +CREATE TRIGGER IF NOT EXISTS val_sum BEFORE INSERT ON t1 FOR EACH ROW SET @sum = @sum + NEW.val; +SET @sum=0; +INSERT INTO t1 VALUES (10), (20), (30); +SELECT @sum; +@sum +60 +CREATE TRIGGER IF NOT EXISTS val_sum_new BEFORE INSERT ON t1 FOR EACH ROW SET @sum = @sum + NEW.val; +CREATE TRIGGER IF NOT EXISTS val_sum AFTER INSERT ON t1 FOR EACH ROW SET @sum = @sum + 1 + NEW.val; +Warnings: +Note 1359 Trigger 'db1.val_sum' already exists +CREATE OR REPLACE TRIGGER IF NOT EXISTS val_sum BEFORE INSERT ON t1 FOR EACH ROW SET @sum = @sum + 2 + NEW.val; +ERROR HY000: Incorrect usage of OR REPLACE and IF NOT EXISTS +SELECT ACTION_STATEMENT FROM INFORMATION_SCHEMA.TRIGGERS WHERE TRIGGER_NAME='val_sum'; +ACTION_STATEMENT +SET @sum = @sum + NEW.val +CREATE OR REPLACE TRIGGER val_sum BEFORE INSERT ON t1 FOR EACH ROW SET @sum = @sum + 3 + NEW.val; +SELECT ACTION_STATEMENT FROM INFORMATION_SCHEMA.TRIGGERS WHERE TRIGGER_NAME='val_sum'; +ACTION_STATEMENT +SET @sum = @sum + 3 + NEW.val +CREATE TRIGGER val_sum BEFORE INSERT ON t1 FOR EACH ROW SET @sum = @sum + 4 + NEW.val; +ERROR HY000: Trigger 'db1.val_sum' already exists +SELECT ACTION_STATEMENT FROM INFORMATION_SCHEMA.TRIGGERS WHERE TRIGGER_NAME='val_sum'; +ACTION_STATEMENT +SET @sum = @sum + 3 + NEW.val +# Clearing up +DROP TRIGGER IF EXISTS val_sum; +SELECT ACTION_STATEMENT FROM INFORMATION_SCHEMA.TRIGGERS WHERE TRIGGER_NAME='val_sum'; +ACTION_STATEMENT +DROP TRIGGER IF EXISTS val_sum; +Warnings: +Note 1360 Trigger does not exist +DROP TABLE t1; +DROP DATABASE db1; |