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

ResultSetMetaData.getTableName returns table alias instead of real table name

Details

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

    Description

      ResultSetMetaData.getTableName returns table alias instead of real table name in for example following type of query.

      SELECT id FROM t1 AS t1_alias

      Currently ResultSetMetaData.getTableName would return t1_alias.

      ResultSetMetaData.getTableName should return the real table name and this was fixed in the MySQL Connector/J some years back. An URL parameter called useOldAliasMetadataBehavior was introduced if someone wants to continue using the old behaviour.

      Attachments

        Issue Links

          Activity

            ratzpo Rasmus Johansson (Inactive) created issue -
            ratzpo Rasmus Johansson (Inactive) made changes -
            Field Original Value New Value
            Status Open [ 1 ] In Progress [ 3 ]

            Hello~

            i think additional fix need about alias thing of column

            please read : http://dev.mysql.com/doc/connector-j/en/connector-j-installing-upgrading-5-1.html

            ResultSetMetaData.getColumnName() is display real column (mariadb connector/j 1.1.8ver) so
            if attach parameter ( useOldAliasMetadataBehavior=true)
            then ResultSetMetaData.getColumnName() need display alias column name as getColumnLabel().

            (mysql connector done, mariadb connector not yet)

            Like table, column alias need old behaviour

            Thanks.

            seung hoon seung hoon yoo added a comment - Hello~ i think additional fix need about alias thing of column please read : http://dev.mysql.com/doc/connector-j/en/connector-j-installing-upgrading-5-1.html ResultSetMetaData.getColumnName() is display real column (mariadb connector/j 1.1.8ver) so if attach parameter ( useOldAliasMetadataBehavior=true) then ResultSetMetaData.getColumnName() need display alias column name as getColumnLabel(). (mysql connector done, mariadb connector not yet) Like table, column alias need old behaviour Thanks.
            wlad Vladislav Vaintroub added a comment - - edited

            useOldAliasMetadataBehavior=true was backward compatibility fix for own non-JDBC compliant ConnectorJ behavior w.r.t column names, among other things. Whether MariaDBs driver should introduce a new feature with that parameter is a good question.

            wlad Vladislav Vaintroub added a comment - - edited useOldAliasMetadataBehavior=true was backward compatibility fix for own non-JDBC compliant ConnectorJ behavior w.r.t column names, among other things. Whether MariaDBs driver should introduce a new feature with that parameter is a good question.
            diego dupin Diego Dupin made changes -
            Fix Version/s 1.1.9 [ 16400 ]
            seung hoon seung hoon yoo added a comment - - edited

            hi~ I just 2 row add in 1.1.9 connector gihub script u contribute
            that make column label name display instead column name when useOldAliasMetadataBehavior option true

            how about my idea,
            and would u add this source (2 line in MySQLResultSetMetaData.java) next release 1.1.9 ver??

            MySQLResultSetMetaData.java

             public String getColumnName(final int column) throws SQLException {
                    String s =  getColumnInformation(column).getOriginalName();      
            +        if (returnTableAlias == true)    // if useOldAliasMetadataBehavior=true then getColumnName return getCoulmnLabel
            +         s =  getColumnLabel(column); 
                  
                    if ("".equals(s))  // odd things that are no columns, e.g count(*)
                        s =  getColumnLabel(column);
                    return s;
                }

            seung hoon seung hoon yoo added a comment - - edited hi~ I just 2 row add in 1.1.9 connector gihub script u contribute that make column label name display instead column name when useOldAliasMetadataBehavior option true how about my idea, and would u add this source (2 line in MySQLResultSetMetaData.java) next release 1.1.9 ver?? MySQLResultSetMetaData.java public String getColumnName( final int column) throws SQLException { String s = getColumnInformation(column).getOriginalName(); + if (returnTableAlias == true ) // if useOldAliasMetadataBehavior=true then getColumnName return getCoulmnLabel + s = getColumnLabel(column); if ( "" .equals(s)) // odd things that are no columns, e.g count(*) s = getColumnLabel(column); return s; }
            ratzpo Rasmus Johansson (Inactive) made changes -
            Workflow MariaDB connectors [ 60575 ] MariaDB v3 [ 70192 ]
            diego dupin Diego Dupin made changes -
            Component/s Other [ 12201 ]
            Resolution Fixed [ 1 ]
            Status In Progress [ 3 ] Closed [ 6 ]
            seung hoon seung hoon yoo made changes -
            serg Sergei Golubchik made changes -
            Workflow MariaDB v3 [ 70192 ] MariaDB v4 [ 134768 ]

            People

              ratzpo Rasmus Johansson (Inactive)
              ratzpo Rasmus Johansson (Inactive)
              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.