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

Diagnostics Area Status Conflict (set_ok_status)

    XMLWordPrintable

Details

    • Not for Release Notes

    Description

      Reproduction Steps

      CREATE TEMPORARY TABLE v0 (
      v1 CHAR NOT NULL CHECK ( v4 NOT IN ( 'x' , 'x' ) ),
      v2 NUMERIC PRIMARY KEY,
      v3 TEXT,
      v4 INT NOT NULL
      );

      Key Point: The CHECK constraint CHECK ( v4 NOT IN ( 'x' , 'x' ) ) references column v4 which is not yet defined
      (forward reference).
      Stack Trace

      #0 __pthread_kill_implementation
      #1 raise
      #2 abort
      #3 __assert_fail_base.cold
      #4 __assert_fail
      #5 Diagnostics_area::set_ok_status (sql/sql_error.cc:357)
      #6 my_ok (sql/sql_class.h:6269)
      #7 Sql_cmd_create_table_like::execute (sql/sql_table.cc:13637)
      #8 mysql_execute_command (sql/sql_parse.cc:5886)
      #9 mysql_parse (sql/sql_parse.cc:7915)
      #10 dispatch_command (sql/sql_parse.cc:1902)
      #11 do_command (sql/sql_parse.cc:1415)
      #12 do_handle_one_connection (sql/sql_connect.cc:1415)

      From AI :

      Root Cause Analysis

      The issue occurs in a CREATE TEMPORARY TABLE statement where the CHECK constraint references a column that has
      not yet been defined (forward reference):

      1. CHECK constraint CHECK ( v4 NOT IN ( 'x' , 'x' ) ) is defined on column v1
      2. The constraint references column v4, which is defined after v1 in the SQL statement
      3. During processing, the diagnostics area gets set to some state (likely a warning or error)
      4. mysql_create_table() returns success (res=0)
      5. When my_ok(thd) is called to set the OK status, it finds the diagnostics area is already set
      6. Assertion fails: !is_set() || (m_status == DA_OK_BULK && is_bulk_op())

      Possible Fix Directions

      1. Properly handle forward references during CHECK constraint validation
      2. Check if the diagnostics area is already set before attempting to set OK status
      3. Ensure error conditions return appropriate error codes instead of success

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              chunlingqin chunlingqin
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

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