-
-
Notifications
You must be signed in to change notification settings - Fork 206
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DDL_TRIGGER not fire on DDL operator COMMENT ON, GRANT and REVOKE [CORE4358] #4680
Comments
Modified by: @sim1984issuetype: Improvement [ 4 ] => Bug [ 1 ] |
Commented by: @asfernandes By design, COMMENT ON does not trigger DDL triggers. I Think ANY DDL STATEMENT means any possible trigger type used in DDL triggers, and COMMENT is not there. |
Commented by: @sim1984 ALTER DATABASE SET LINGER TO 60; In addition to COMMENT ON operators of GRANT and REVOKE also fell out of reviewing |
Modified by: @sim1984description: DDL_TRIGGER not fire on DDL operator COMMENT ON CREATE TABLE DDL_LOG ( ALTER TABLE DDL_LOG ADD PRIMARY KEY (ID); SET TERM ^ ; CREATE OR ALTER TRIGGER TRIG_DDL_LOG_AFTER SET TERM ; ^ --------------------------------- set term ^; create procedure p1 set term ;^ comment on procedure p1 is 'my proc'; drop procedure p1; ID MOMENT USER_NAME EVENT_TYPE OBJECT_TYPE DDL_EVENT OBJECT_NAME SQL_TEXT => DDL_TRIGGER not fire on DDL operator COMMENT ON CREATE TABLE DDL_LOG ( ALTER TABLE DDL_LOG ADD PRIMARY KEY (ID); CREATE SEQUENCE DDL_SEQ; SET TERM ^ ; CREATE OR ALTER TRIGGER TRIG_DDL_LOG_AFTER SET TERM ; ^ --------------------------------- set term ^; create procedure p1 set term ;^ comment on procedure p1 is 'my proc'; drop procedure p1; ID MOMENT USER_NAME EVENT_TYPE OBJECT_TYPE DDL_EVENT OBJECT_NAME SQL_TEXT |
Modified by: @sim1984summary: DDL_TRIGGER not fire on DDL operator COMMENT ON => DDL_TRIGGER not fire on DDL operator COMMENT ON, GRANT and REVOKE |
Commented by: @asfernandes Behavior is now documented in README.ddl_triggers. |
Modified by: @pcisarstatus: Resolved [ 5 ] => Closed [ 6 ] |
Commented by: @dyemanov Adriano, while I tend to agree about COMMENT ON, I'm not so sure about the rest. Some sources describe GRANT / REVOKE as DCL (Data Control Language) but formally they're part of DDL. Shouldn't we support triggers for these commands? Or is it just an implementation issue? |
Commented by: Sean Leyne (seanleyne) Dmitry, Please clarify, do you mean that you agree that COMMENT ON should fire trigger? |
Commented by: @dyemanov I'm not absolutely sure, but I can agree that COMMENT ON should *not* fire triggers, as it does not change the schema itself, only user-defined descriptions. |
Commented by: @asfernandes It's not that is impossible, but grant is different from the others commands. Event names may be: Maybe has others differences and details I'm not seeing now. |
Submitted by: @sim1984
Votes: 1
DDL_TRIGGER not fire on DDL operator COMMENT ON
CREATE TABLE DDL_LOG (
ID INTEGER NOT NULL,
MOMENT DATE NOT NULL,
USER_NAME VARCHAR(31) NOT NULL,
EVENT_TYPE VARCHAR(25) NOT NULL,
OBJECT_TYPE VARCHAR(25) NOT NULL,
DDL_EVENT VARCHAR(25) NOT NULL,
OBJECT_NAME VARCHAR(31) NOT NULL,
SQL_TEXT BLOB SUB_TYPE 1 SEGMENT SIZE 80 NOT NULL
);
ALTER TABLE DDL_LOG ADD PRIMARY KEY (ID);
CREATE SEQUENCE DDL_SEQ;
SET TERM ^ ;
CREATE OR ALTER TRIGGER TRIG_DDL_LOG_AFTER
ACTIVE AFTER ANY DDL STATEMENT POSITION 0
AS
BEGIN
INSERT INTO DDL_LOG (ID,
MOMENT,
USER_NAME,
EVENT_TYPE,
OBJECT_TYPE,
DDL_EVENT,
OBJECT_NAME,
SQL_TEXT)
VALUES (NEXT VALUE FOR DDL_SEQ,
CURRENT_TIMESTAMP,
CURRENT_USER,
RDB$GET_CONTEXT('DDL_TRIGGER', 'EVENT_TYPE'),
RDB$GET_CONTEXT('DDL_TRIGGER', 'OBJECT_TYPE'),
RDB$GET_CONTEXT('DDL_TRIGGER', 'DDL_EVENT'),
RDB$GET_CONTEXT('DDL_TRIGGER', 'OBJECT_NAME'),
RDB$GET_CONTEXT('DDL_TRIGGER', 'SQL_TEXT'));
END^
SET TERM ; ^
---------------------------------
set term ^;
create procedure p1
as
begin
end^
set term ;^
comment on procedure p1 is 'my proc';
drop procedure p1;
ID MOMENT USER_NAME EVENT_TYPE OBJECT_TYPE DDL_EVENT OBJECT_NAME SQL_TEXT
1 04.03.2014 22:00:42 SYSDBA CREATE PROCEDURE CREATE PROCEDURE P1
2 04.03.2014 22:00:42 SYSDBA DROP PROCEDURE DROP PROCEDURE P1
The text was updated successfully, but these errors were encountered: