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

DatabaseMetaData.getBestRowIdentifier() returns primary key columns in an undefined order

    XMLWordPrintable

Details

    Description

      getBestRowIdentifier() builds its result from INFORMATION_SCHEMA.COLUMNS without an ORDER BY clause, so the row order is whatever the server's natural order for that table happens to be.

      MariaDB returns the columns in table order, but MySQL 9.7 returns them differently: for a table with PRIMARY KEY (TBL_ID, PKEY_NAME), the result lists PKEY_NAME before TBL_ID. Applications that rebuild a row identifier from this metadata in the returned order, or compare it with getPrimaryKeys() / getIndexInfo(), get an inconsistent column order depending on the server.

      The JDBC specification only requires these rows to be ordered by SCOPE, which is identical for every row here, so the relative order of the columns was effectively undefined.

      Attachments

        Activity

          People

            diego dupin Diego Dupin
            diego dupin Diego Dupin
            Votes:
            0 Vote for this issue
            Watchers:
            1 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.