New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Failure returning aliased column name [JDBC278] #324
Comments
Commented by: @mrotteveel This is not a bug, it is an intentional change that is documented in the releasenotes See under 'Other fixes and changes': and under: You should use getColumnLabel() instead of getColumnName(). The JDBC specification defines columnName as the original column name (if any), while the columnLabel is the alias defined in the AS clause, or otherwise the columnName if no alias is defined. So you will almost always need to use getColumnLabel(). If you want the old behavior, then you can specify the connection property columnLabelForName=true |
Modified by: @mrotteveel |
Modified by: @mrotteveel |
Commented by: @mrotteveel Specifically for SQuirreL: See also http://stackoverflow.com/q/12709814/466862 |
Commented by: Derryck welas (welas) Mark thanks for your reply, so this "select a.symbol as "Newname" from unit a " complies with jdbc 3.0 (i'm oke with that !) getcolumnLabel() returns the aliased name Just a quick verification this seems to fail "select a.symbol as "newname" from unit a group by symbol" getcolumnLabel() returns the aliased name ---->oke is this impossible for getcolumnName() in this case ? |
Commented by: @mrotteveel If I understand you correctly then "select a.symbol as "newname" from unit a group by symbol" does not show 'symbol' for the columnName? I will need to test that .The only reason I can think of right now, is that Firebird does not include the original column name in the xsqlvar because it is a grouped query. If so, that is a limitation of Firebird. I will get back to you about that. |
Commented by: Derryck welas (welas) Rechecked: "select a.symbol as "newname" from unit a group by symbol" fails on 2 calls: |
Modified by: Derryck welas (welas)Attachment: jdbc3_fail.png [ 12246 ] |
Commented by: @mrotteveel As you are also missing the tableName, I am almost sure that Firebird somehow forgets this info in a grouped query, so it is not included in the xsqlvar. I don't think I will have time to actually test this until somewhere next week, as the Firebird Conference is this week. |
Commented by: @mrotteveel The output of ISQL with SET SQLDA_DISPLAY ON shows it is a limitation of Firebird itself: SQL> select RDB$RELATION_ID AS RDB$RELATION_ID FROM RDB$DATABASE; INPUT SQLDA version: 1 sqln: 10 sqld: 0 OUTPUT SQLDA version: 1 sqln: 20 sqld: 1 RDB$RELATION_ID
SQL> select RDB$RELATION_ID AS RDB$RELATION_ID FROM RDB$DATABASE GROUP BY RDB$RELATION_ID; INPUT SQLDA version: 1 sqln: 10 sqld: 0 OUTPUT SQLDA version: 1 sqln: 20 sqld: 1 RDB$RELATION_ID
|
Commented by: @mrotteveel Interestingly enough, removing the alis does display it, so it is most likely a bug: SQL> select RDB$RELATION_ID FROM RDB$DATABASE GROUP BY RDB$RELATION_ID; INPUT SQLDA version: 1 sqln: 10 sqld: 0 OUTPUT SQLDA version: 1 sqln: 20 sqld: 1 RDB$RELATION_ID
|
Modified by: @mrotteveel |
Commented by: @mrotteveel Opened CORE3973 to report problem in Firebird. I will close this issue as I can't solve it in Jaybird. |
Submitted by: Derryck welas (welas)
Duplicates JDBC260
Is related to JDBC162
Is replaced by CORE3973
Attachments:
jdbc3_fail.png
Dear Developers i found this error during QA,
A failure returning aliased column name(s)
failed casesl:
select a.symbol as "Newname" from unit a
select a.symbol as newname from unit a
select symbol as "NewName" from unit
select symbol as newname from unit
the driver returns "symbol" for column name while it should return "newname" as the column name.
-----------------------------------
quick ddl :
CREATE TABLE UNIT
(
SYSTEM_ID Integer,
SYMBOL Varchar(10),
DESCRIPTION Varchar(80)
);
jaybird 2.2.0 -> fails
jaybird 2.2.1 -> fails
jaybird 2.1.6 -> Oke
Flamerobin 0.9.2 -->oke
The text was updated successfully, but these errors were encountered: