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

DatabaseMetadata#getTables with null value for tableNamePattern throws Syntax error

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • 3.0.3
    • 3.0.4
    • metadata
    • None
    • MariaDB 10.6 from Docker Hub

    Description

      The following works with JDBC client 2.7.5:

      Connection conn = ...;
      DatabaseMetaData meta = conn.getMetaData();
      meta.getTables(null, null, null, new String[] { "TABLE" });
      

      The same exact code throws syntax error with 3.0.3:

      java.sql.SQLSyntaxErrorException: (conn=3) You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'AND TABLE_TYPE IN ('BASE TABLE','SYSTEM VERSIONED') ORDER BY TABLE_TYPE, TABL...' at line 1
              at org.mariadb.jdbc.export.ExceptionFactory.createException(ExceptionFactory.java:270) ~[mariadb-java-client-3.0.3.jar:?]
              at org.mariadb.jdbc.export.ExceptionFactory.create(ExceptionFactory.java:358) ~[mariadb-java-client-3.0.3.jar:?]
              at org.mariadb.jdbc.message.ClientMessage.readPacket(ClientMessage.java:133) ~[mariadb-java-client-3.0.3.jar:?]
              at org.mariadb.jdbc.client.impl.StandardClient.readPacket(StandardClient.java:807) ~[mariadb-java-client-3.0.3.jar:?]
              at org.mariadb.jdbc.client.impl.StandardClient.readResults(StandardClient.java:746) ~[mariadb-java-client-3.0.3.jar:?]
              at org.mariadb.jdbc.client.impl.StandardClient.readResponse(StandardClient.java:665) ~[mariadb-java-client-3.0.3.jar:?]
              at org.mariadb.jdbc.client.impl.StandardClient.execute(StandardClient.java:608) ~[mariadb-java-client-3.0.3.jar:?]
              at org.mariadb.jdbc.Statement.executeInternal(Statement.java:906) ~[mariadb-java-client-3.0.3.jar:?]
              at org.mariadb.jdbc.Statement.executeQuery(Statement.java:114) ~[mariadb-java-client-3.0.3.jar:?]
              at org.mariadb.jdbc.DatabaseMetaData.executeQuery(DatabaseMetaData.java:470) ~[mariadb-java-client-3.0.3.jar:?]
              at org.mariadb.jdbc.DatabaseMetaData.getTables(DatabaseMetaData.java:657) ~[mariadb-java-client-3.0.3.jar:?]
      

      Attachments

        Activity

          People

            diego dupin Diego Dupin
            ilgrosso Francesco Chicchiriccò
            Votes:
            1 Vote for this issue
            Watchers:
            4 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.