Details
-
Bug
-
Status: Open (View Workflow)
-
Trivial
-
Resolution: Unresolved
-
5.5, 10.0, 10.1
Description
I am not sure it needs to be fixed, it will only create potential incompatibility between versions without any serious gain; but I want to have it filed, so that next time i don't need to waste time trying to figure out what's going on with error codes.
There is ER_TRG_ON_VIEW_OR_TEMP_TABLE (as of 5.5-10.1 and 5.5-5.7, it's error 1361), with the error message "Trigger's '%s' is view or temporary table"; but it's only returned upon an attempt to create a trigger on a temporary table, while creating a trigger on a view produces more generic ER_WRONG_OBJECT (error 1347, '%s' is not BASE TABLE).
CREATE TABLE t1 (i INT); |
CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW SET @a=1; |
|
CREATE VIEW v1 AS SELECT * FROM t1; |
--echo # This query produces 1347 (ER_WRONG_OBJECT): 'test.v1' is not BASE TABLE
|
--error ER_WRONG_OBJECT
|
CREATE TRIGGER tr2 BEFORE INSERT ON v1 FOR EACH ROW SET @a=1; |
|
CREATE TEMPORARY TABLE t1 (i INT); |
--echo # This query produces 1361 (ER_TRG_ON_VIEW_OR_TEMP_TABLE): Trigger's 't1' is view or temporary table
|
--error ER_TRG_ON_VIEW_OR_TEMP_TABLE
|
CREATE TRIGGER tr3 BEFORE INSERT ON t1 FOR EACH ROW SET @a=1; |
|
DROP TEMPORARY TABLE t1; |
DROP VIEW v1; |
DROP TABLE t1; |
Reproducible on all of MariaDB 5.5-10.2.2 and MySQL 5.5-5.7.