Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-9756

CREATE TRIGGER: no database selected (determine trigger location automatically based on the table location)

    XMLWordPrintable

Details

    • Task
    • Status: Open (View Workflow)
    • Minor
    • Resolution: Unresolved
    • None
    • Triggers
    • None

    Description

      I have an application that runs queries like this:

      CREATE TRIGGER t_ai
          AFTER INSERT
          ON test.t
          FOR EACH ROW
      BEGIN
          INSERT INTO __test_changeset.t
                  SET
                      `id` = NEW.`id`,
                      change_timestamp = NOW(6),
                      change_type = 'INSERT'
              ;
      END;
      

      ...and receives a "no database selected" error from MariaDB.

      The error is technically correct, because the query does not specify in which database the trigger must be created. However it specifies in which database the table is, so the trigger needs to be there.

      You may consider this as a funny feature request instead of a bug. However spending time to debug a query with a problem like this is not that funny... maybe this is easy to fix?

      NOTE: I found this problem on 10.0, didn't check 10.1 or MySQL

      Attachments

        Activity

          People

            Unassigned Unassigned
            f_razzoli Federico Razzoli
            Votes:
            0 Vote for this issue
            Watchers:
            3 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.