Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-10764 PL/SQL parser - Phase 2
  3. MDEV-10164

Add support for TRIGGERS that fire on multiple events

    XMLWordPrintable

Details

    • Technical task
    • Status: Open (View Workflow)
    • Major
    • Resolution: Unresolved
    • None
    • None
    • None

    Description

      Add support for TRIGGER events that can fire for one or many of
      INSERT, UPDATE and DELETE

      The current syntax for triggers are:

      CREATE [OR REPLACE]
          [DEFINER = { user | CURRENT_USER }]
          TRIGGER [IF NOT EXISTS] trigger_name trigger_time trigger_event
          ON tbl_name FOR EACH ROW trigger_stmt
      

      The task is to replace trigger_event with:

       { event [ OR ... ] }
      

      Oracle and PostgreSQL both support this extension to CREATE TRIGGER.

      PostgreSQL solves the issue witth information schema by duplicating the trigger for as many times as there are events.The primary key of the view triggers is because of this trigger_catalog, trigger_schema, event_object_table, trigger_name, event.

      To distinguish which event fired the trigger, Oracle supports event flags:

      CREATE TRIGGER tr1
      BEFORE DELETE OR INSERT OR UPDATE ON t1
      FOR EACH ROW
      BEGIN
        IF INSERTING THEN   ...
        ELSIF DELETING THEN ...
        ELSIF UPDATING THEN ...
        ENDIF;
      END;
      

      We should also support this.

      Attachments

        Activity

          People

            Unassigned Unassigned
            monty Michael Widenius
            Votes:
            3 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.