[MDEV-10928] Inconsistent use of ER_TRG_ON_VIEW_OR_TEMP_TABLE vs ER_WRONG_OBJECT Created: 2016-09-30  Updated: 2016-10-30

Status: Open
Project: MariaDB Server
Component/s: Data Definition - Temporary, OTHER, Views
Affects Version/s: 5.5, 10.0, 10.1
Fix Version/s: 10.2

Type: Bug Priority: Trivial
Reporter: Elena Stepanova Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: upstream


 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.


Generated at Thu Feb 08 07:46:00 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.