Skip to content
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

Original table name and column name and owner missing from SQLDA for aliased column in grouped query [CORE3973] #4306

Closed
firebird-issue-importer opened this issue Nov 5, 2012 · 9 comments

Comments

@firebird-issue-importer
Copy link

firebird-issue-importer commented Nov 5, 2012

Submitted by: @mrotteveel

Replaces JDBC278
Is related to QA580

The column description (sqlda / sql info) is missing the original tablename, original columnname and owner when the column has an alias and occurs in a grouped query. In Jaybird this is used to report the original table and column name in the ResultSetMetaData. See JDBC278 for an issue triggered by this.

This can also be demonstrated in ISQL with SET SQLDA_DISPLAY ON:

1) Normal query with alias (both table, columnname, alias and owner are present for both columns):

SQL> select RDB$RELATION_ID AS R_ID, RDB$CHARACTER_SET_NAME FROM RDB$DATABASE;

INPUT SQLDA version: 1 sqln: 10 sqld: 0

OUTPUT SQLDA version: 1 sqln: 20 sqld: 2
01: sqltype: 501 SHORT Nullable sqlscale: 0 sqlsubtype: 0 sqllen: 2
: name: (15)RDB$RELATION_ID alias: (4)R_ID
: table: (12)RDB$DATABASE owner: (6)SYSDBA
02: sqltype: 453 TEXT Nullable sqlscale: 0 sqlsubtype: 3 sqllen: 93
: name: (22)RDB$CHARACTER_SET_NAME alias: (22)RDB$CHARACTER_SET_NAME
: table: (12)RDB$DATABASE owner: (6)SYSDBA

2) Grouped query with alias (only non-aliased column has table, columnname and owner):

SQL> select RDB$RELATION_ID AS R_ID, RDB$CHARACTER_SET_NAME FROM RDB$DATABASE GROUP BY RDB$RELATION_ID, RDB$CHARACTER_SET_NAME;

INPUT SQLDA version: 1 sqln: 10 sqld: 0

OUTPUT SQLDA version: 1 sqln: 20 sqld: 2
01: sqltype: 501 SHORT Nullable sqlscale: 0 sqlsubtype: 0 sqllen: 2
: name: (0) alias: (4)R_ID
: table: (0) owner: (0)
02: sqltype: 453 TEXT Nullable sqlscale: 0 sqlsubtype: 3 sqllen: 93
: name: (22)RDB$CHARACTER_SET_NAME alias: (22)RDB$CHARACTER_SET_NAME
: table: (12)RDB$DATABASE owner: (6)SYSDBA

EXPECTATION: In this case for entry 01 I would expect:
01: sqltype: 501 SHORT Nullable sqlscale: 0 sqlsubtype: 0 sqllen: 2
: name: (15)RDB$RELATION_ID alias: (4)R_ID
: table: (12)RDB$DATABASE owner: (6)SYSDBA

Commits: 745a457

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented Nov 5, 2012

Modified by: @mrotteveel

Link: This issue replaces JDBC278 [ JDBC278 ]

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented Nov 5, 2012

Modified by: @mrotteveel

description: The column description (sqlda / sql info) is missing the original tablename, original columnname and owner when the column has an alias and occurs in a grouped query. In Jaybird this is used to report the original table and column name in the ResultSetMetaData. See JDBC278 for an issue triggered by this.

This can also be demonstrated in ISQL with SET SQLDA_DISPLAY ON:

1) Normal query with alias (both table, columnname, alias and owner are present for both columns):

SQL> select RDB$RELATION_ID AS R_ID, RDB$CHARACTER_SET_NAME FROM RDB$DATABASE;

INPUT SQLDA version: 1 sqln: 10 sqld: 0

OUTPUT SQLDA version: 1 sqln: 20 sqld: 2
01: sqltype: 501 SHORT Nullable sqlscale: 0 sqlsubtype: 0 sqllen: 2
: name: (15)RDB$RELATION_ID alias: (4)R_ID
: table: (12)RDB$DATABASE owner: (6)SYSDBA
02: sqltype: 453 TEXT Nullable sqlscale: 0 sqlsubtype: 3 sqllen: 93
: name: (22)RDB$CHARACTER_SET_NAME alias: (22)RDB$CHARACTER_SET_NAME
: table: (12)RDB$DATABASE owner: (6)SYSDBA

2) Grouped query with alias (only non-aliased column has table, columnname and owner):

SQL> select RDB$RELATION_ID AS R_ID, RDB$CHARACTER_SET_NAME FROM RDB$DATABASE GROUP BY RDB$RELATION_ID, RDB$CHARACTER_SET_NAME;

INPUT SQLDA version: 1 sqln: 10 sqld: 0

OUTPUT SQLDA version: 1 sqln: 20 sqld: 2
01: sqltype: 501 SHORT Nullable sqlscale: 0 sqlsubtype: 0 sqllen: 2
: name: (0) alias: (4)R_ID
: table: (0) owner: (0)
02: sqltype: 453 TEXT Nullable sqlscale: 0 sqlsubtype: 3 sqllen: 93
: name: (22)RDB$CHARACTER_SET_NAME alias: (22)RDB$CHARACTER_SET_NAME
: table: (12)RDB$DATABASE owner: (6)SYSDBA

EXPECTATION: In this case for entry 01 I would expect:
01: sqltype: 501 SHORT Nullable sqlscale: 0 sqlsubtype: 0 sqllen: 2
: name: (22)RDB$CHARACTER_SET_NAME alias: (4)R_ID
: table: (12)RDB$DATABASE owner: (6)SYSDBA

=>

The column description (sqlda / sql info) is missing the original tablename, original columnname and owner when the column has an alias and occurs in a grouped query. In Jaybird this is used to report the original table and column name in the ResultSetMetaData. See JDBC278 for an issue triggered by this.

This can also be demonstrated in ISQL with SET SQLDA_DISPLAY ON:

1) Normal query with alias (both table, columnname, alias and owner are present for both columns):

SQL> select RDB$RELATION_ID AS R_ID, RDB$CHARACTER_SET_NAME FROM RDB$DATABASE;

INPUT SQLDA version: 1 sqln: 10 sqld: 0

OUTPUT SQLDA version: 1 sqln: 20 sqld: 2
01: sqltype: 501 SHORT Nullable sqlscale: 0 sqlsubtype: 0 sqllen: 2
: name: (15)RDB$RELATION_ID alias: (4)R_ID
: table: (12)RDB$DATABASE owner: (6)SYSDBA
02: sqltype: 453 TEXT Nullable sqlscale: 0 sqlsubtype: 3 sqllen: 93
: name: (22)RDB$CHARACTER_SET_NAME alias: (22)RDB$CHARACTER_SET_NAME
: table: (12)RDB$DATABASE owner: (6)SYSDBA

2) Grouped query with alias (only non-aliased column has table, columnname and owner):

SQL> select RDB$RELATION_ID AS R_ID, RDB$CHARACTER_SET_NAME FROM RDB$DATABASE GROUP BY RDB$RELATION_ID, RDB$CHARACTER_SET_NAME;

INPUT SQLDA version: 1 sqln: 10 sqld: 0

OUTPUT SQLDA version: 1 sqln: 20 sqld: 2
01: sqltype: 501 SHORT Nullable sqlscale: 0 sqlsubtype: 0 sqllen: 2
: name: (0) alias: (4)R_ID
: table: (0) owner: (0)
02: sqltype: 453 TEXT Nullable sqlscale: 0 sqlsubtype: 3 sqllen: 93
: name: (22)RDB$CHARACTER_SET_NAME alias: (22)RDB$CHARACTER_SET_NAME
: table: (12)RDB$DATABASE owner: (6)SYSDBA

EXPECTATION: In this case for entry 01 I would expect:
01: sqltype: 501 SHORT Nullable sqlscale: 0 sqlsubtype: 0 sqllen: 2
: name: (15)RDB$RELATION_ID alias: (4)R_ID
: table: (12)RDB$DATABASE owner: (6)SYSDBA

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented Nov 5, 2012

Commented by: Sean Leyne (seanleyne)

Small correction to the subject provide better context.

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented Nov 5, 2012

Modified by: Sean Leyne (seanleyne)

summary: Original table name and column name and owner missing from aliased column in grouped query => Original table name and column name and owner missing from SQLDA for aliased column in grouped query

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented Nov 7, 2012

Modified by: @asfernandes

status: Open [ 1 ] => Resolved [ 5 ]

resolution: Fixed [ 1 ]

Fix Version: 3.0 Alpha 1 [ 10331 ]

assignee: Adriano dos Santos Fernandes [ asfernandes ]

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented Mar 29, 2014

Modified by: @pcisar

Link: This issue is related to QA580 [ QA580 ]

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented May 28, 2015

Modified by: @pavel-zotov

status: Resolved [ 5 ] => Resolved [ 5 ]

QA Status: Done successfully

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented Sep 23, 2015

Commented by: @pcisar

Test created.

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented Sep 23, 2015

Modified by: @pcisar

status: Resolved [ 5 ] => Closed [ 6 ]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants