trigger errors?

Asked by alex

Just copy this strings into your sql client:

-- Tables schema for example

CREATE TABLE `test_1` (
  `id` int(11) DEFAULT NULL
) ENGINE=InnoDB;

CREATE TABLE `test_2` (
  `id` int(11) DEFAULT NULL
) ENGINE=InnoDB;

-- Views schema for example

CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `view_test_2` AS select `test_2`.`id` AS `id` from `test_2`;

-- Triggers schema for example

CREATE
TRIGGER test_delete
AFTER DELETE
ON test_1 FOR EACH ROW
INSERT INTO view_test_2 VALUES(1);

CREATE
TRIGGER test_insert
AFTER INSERT
ON test_2 FOR EACH ROW
SELECT IF(count(id) > 0, 1, NULL) as t into @test FROM test_1; -- show error Table test_1 dosn't exist :)

---------------------------------------------

NOW insert some values into table test_1 and try to delete any row. You should be got error Table 'test_1' doesn't exist

Question information

Language:
English Edit question
Status:
Expired
For:
Percona Server moved to https://jira.percona.com/projects/PS Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Launchpad Janitor (janitor) said :
#1

This question was expired because it remained in the 'Open' state without activity for the last 15 days.