You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
add reference to OLD variable in the not existing trigger
SET TERM ^ ;
ALTER TRIGGER XYZXX
ACTIVE AFTER DELETE POSITION 1000
AS
DECLARE VARIABLE VAR_OLD_UMOWA_ID CHAR(7);
begin
VAR_OLD_UMOWA_ID = OLD.UMOWA_ID;
END^
SET TERM ; ^
Although the ALTER is the "operation", the fact that the body of the trigger is evaluated/verified before the existence of the trigger is (IMO) not significant. In fact, it can be thought of as logical, since the command syntax must be valid before executed.
The first example is syntactically valid/correct, so the command is attempted, which is why the "not found" is reported.
i understand your point. Yes, whole script must be valid.
But how it can be validated if there is no context? You know, alter trigger does not have name of the table.
Then to validate something, you must refer to table first to see if OLD.FIELD exists in that table.
I also take your point, but trigger existence does not need to be the first step.
The fact that the error refers to "column unknown" can be considered as pointer to the user that their base syntax is missing the "... FOR {relation name}". But that fails to consider the DB triggers syntax for which there is no "... FOR {relation name}".
Sean,
another good point, but i this particular example,
error message refer exactly that FB know that it work with trigger. It know exactly with which one
unsuccessful metadata update
ALTER TRIGGER XYZXX failed
Dynamic SQL Error
FB know also that this is "ALTER" operation. For alter operation first should be check existence of the object.
Submitted by: @livius2
try altering not existing trigger
SET TERM ^ ;
ALTER TRIGGER XYZXX
ACTIVE AFTER DELETE POSITION 1000
AS
DECLARE VARIABLE VAR_OLD_UMOWA_ID CHAR(7);
begin
END^
SET TERM ; ^
as expected:
Engine Code : 335544351
Engine Message :
unsuccessful metadata update
ALTER TRIGGER XYZXX failed
Trigger XYZXX not found
--------------------------------------------------------------------------------
add reference to OLD variable in the not existing trigger
SET TERM ^ ;
ALTER TRIGGER XYZXX
ACTIVE AFTER DELETE POSITION 1000
AS
DECLARE VARIABLE VAR_OLD_UMOWA_ID CHAR(7);
begin
VAR_OLD_UMOWA_ID = OLD.UMOWA_ID;
END^
SET TERM ; ^
Engine Code : 335544351
Engine Message :
unsuccessful metadata update
ALTER TRIGGER XYZXX failed
Dynamic SQL Error
SQL error code = -206
Column unknown
OLD.UMOWA_ID
----------------------------------------------------------------
but the main reason is that this trigger does not exists at all
the body does not matter here
The text was updated successfully, but these errors were encountered: