It is not possible to create a ddl-trigger with "any DDL statement" clause
--------------------------------------------------------------------------

                 Key: CORE-3964
                 URL: http://tracker.firebirdsql.org/browse/CORE-3964
             Project: Firebird Core
          Issue Type: Bug
    Affects Versions: 3.0 Initial
         Environment: probably all platforms (tested on Windows 7.0 and Ubuntu 
12.04)
            Reporter: Frank Schlottmann-Goedde


Using the following script in isql against the employee database demonstrates 
the error

/*
It is not possible to create a ddl-trigger with "any DDL statement" clause

fails with:

Statement failed, SQLSTATE = 42000
unsuccessful metadata update
-CREATE TRIGGER TAA_SQL1 failed
-Invalid command
-Database trigger type can't be changed
probably due to the following code in DdlNodes.epp:
2967:// ASF: Unregistered bug (2.0, 2.1, 2.5, 3.0): CREATE OR ALTER TRIGGER 
accepts different table
         // than one used in already created trigger.

        AutoCacheRequest requestHandle(tdbb, drq_m_trigger2, DYN_REQUESTS);

        FOR (REQUEST_HANDLE requestHandle TRANSACTION_HANDLE transaction)
                TRG IN RDB$TRIGGERS
                WITH TRG.RDB$TRIGGER_NAME EQ name.c_str()
        {
                if (type.specified && type.value != (FB_UINT64) 
TRG.RDB$TRIGGER_TYPE &&
                        TRG.RDB$RELATION_NAME.NULL)
                {
                        status_exception::raise(
                                Arg::Gds(isc_dsql_command_err) <<
                                Arg::Gds(isc_dsql_db_trigger_type_cant_change));
                }
*/


CREATE TABLE MP$MODIFIED_TABLES (
    RELATION_NAME   CHAR(31)
);

CREATE INDEX MP$MODIFIED_TABLES_IDX ON MP$MODIFIED_TABLES (RELATION_NAME);

set term ^;
create trigger TAA_SQL1
active after any DDL statement position 0
as
begin
  if ((RDB$GET_CONTEXT('DDL_TRIGGER', 'OBJECT_TYPE') = 'TABLE') and
      (RDB$GET_CONTEXT('DDL_TRIGGER', 'EVENT_TYPE') in ('CREATE', 'DROP') or 
          (RDB$GET_CONTEXT('DDL_TRIGGER', 'SQL_SOURCE') containing 'FIELD'))) 
then
    insert into MP$MODIFIED_TABLES (RELATION_NAME)
    values (RDB$GET_CONTEXT('DDL_TRIGGER', 'OBJECT_NAME'));
end^
set term ;^




-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

------------------------------------------------------------------------------
The Windows 8 Center - In partnership with Sourceforge
Your idea - your app - 30 days.
Get started!
http://windows8center.sourceforge.net/
what-html-developers-need-to-know-about-coding-windows-8-metro-style-apps/
Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel

Reply via email to