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

DELETE .. RETURNING sometimes returns OK packet instead of result set

    XMLWordPrintable

Details

    • Bug
    • Status: Open (View Workflow)
    • Major
    • Resolution: Unresolved
    • 11.4
    • None
    • Server
    • None

    Description

      Sometimes, depending on WHERE clause, DELETE .. RETURNING can return OK packet,
      instead of expected result set.

      Apparently, it happens with WHERE FALSE or WHERE 0.
      There is a difference for connectors, some of them, some are strict, and will throw errors, if there is no result set, and it is expected. Also, someone might just add WHERE FALSE for "dry run", to examine the result set metadata without actually deleting anything.

      I did not check if this applies to other DML RETURNING clauses.
      I did not check if this applies to versions earlier than 11.4

      Reproduce with command line client

      C:\> mariadb -uroot --column-type-info test
      Welcome to the MariaDB monitor.  Commands end with ; or \g.
      Your MariaDB connection id is 8
      Server version: 11.4.3-MariaDB Source distribution
       
      Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
       
      Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
       
      MariaDB [test]> create table t(i int);
      Query OK, 0 rows affected (0.010 sec)
       
      MariaDB [test]> delete from t  returning i;
      Field   1:  `i`
      Org_field:  `i`
      Catalog:    `def`
      Database:   `test`
      Table:      `t`
      Org_table:  `t`
      Type:       LONG
      Collation:  binary (63)
      Length:     11
      Max_length: 0
      Decimals:   0
      Flags:      NUM
       
       
      0 rows in set (0.000 sec)
       
      MariaDB [test]> delete from t  where false returning i;
      Query OK, 0 rows affected (0.001 sec)
       
      MariaDB [test]> delete from t  where 0 returning i;
      Query OK, 0 rows affected (0.001 sec)
      
      

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              wlad Vladislav Vaintroub
              Votes:
              1 Vote for this issue
              Watchers:
              4 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.