Uploaded image for project: 'MariaDB Connector/J'
  1. MariaDB Connector/J
  2. CONJ-1192

Regression in version 3.4.0 when running executeQuery() on DELETE .. RETURNING statements

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • 3.4.0
    • 3.4.1
    • Other
    • None

    Description

      Try this code:

      try (Statement s = connection.createStatement()) {
          s.executeUpdate("create table t (i int primary key)");
       
          try (ResultSet rs = s.executeQuery("""
              delete from t
              where false
              returning i
              """)) {
              while (rs.next())
                  System.out.println(rs.getInt(1));
          }
          finally {
              s.executeUpdate("drop table t");
          }
      }
      

      It should work out of the box, which it did with driver versions 3.3.x. With 3.4.0, it throws this error:

      0
      Statement.executeQuery() command does NOT return a result-set as expected. Either use Statement.execute(), Statement.executeUpdate(), or correct command
      null
      java.sql.SQLException: Statement.executeQuery() command does NOT return a result-set as expected. Either use Statement.execute(), Statement.executeUpdate(), or correct command
      	at org.mariadb.jdbc.Statement.executeQuery(Statement.java:171)
      	at org.jooq.testscripts.JDBC.main(JDBC.java:42)
      

      The difference can be seen in the implementations:

      The relevant change is this one:

      Due to CONJ-1125.

      Both static and prepared statements have this regression.

      I didn't check for empty UPDATE .. RETURNING or INSERT .. RETURNING statements, but I'd guess they'll also expose this regression.

      Attachments

        Issue Links

          Activity

            People

              diego dupin Diego Dupin
              lukas.eder Lukas Eder
              Votes:
              0 Vote for this issue
              Watchers:
              3 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.