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

INSERT ... RETURNING sends metadata on error

    XMLWordPrintable

Details

    Description

      When INSERT ... RETURNING fails, it sends metadata and afterwards error packet:

        rc= mysql_query(mysql, "CREATE TEMPORARY TABLE t1 (a int not null auto_increment primary key, b json)");
        check_mysql_rc(rc, mysql);
       
        rc= mysql_query(mysql, "INSERT INTO t1 (a,b) VALUES (NULL, '[incorrect json]') RETURNING a");
        check_mysql_rc(rc, mysql);  /* <- this should fail */
       
        result= mysql_store_result(mysql);
        mysql_free_result(result);
       
        diag("Error: %s", mysql_error(mysql));
      

      Output:

      Error: CONSTRAINT `t1.b` failed for `test`.`t1`
      

      Attachments

        Activity

          People

            rucha174 Rucha Deodhar
            georg Georg Richter
            Votes:
            0 Vote for this issue
            Watchers:
            5 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.