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

isc_info_sql_relation_alias reports incorrect alias for CTE or nested queries [CORE5655] #5921

Closed
firebird-issue-importer opened this issue Nov 6, 2017 · 19 comments

Comments

@firebird-issue-importer
Copy link

firebird-issue-importer commented Nov 6, 2017

Submitted by: @mrotteveel

Is duplicated by JDBC513

Votes: 1

For the following query

with CTE as (SELECT column1 from TABLEA T)
select CT.column1 from CTE CT

isc_info_sql_relation_alias reports an incorrect alias. It reports 'CT T', while 'CT' is expected.

Note that this also applies for all variants with/without an explicit alias, for example

with CTE as (SELECT column1 from TABLEA)
select column1 from CTE

will report 'CTE TABLEA' instead of 'CTE'

And for nested queries, eg

select * from (select column1 from tablea t) d

will return an alias 'd t' instead of 'd'.

This is especially a problem if you use the alias information to generate enhancements for a base query (see JDBC513).

Commits: ae6d1ba bf220ea d57fef5 FirebirdSQL/jaybird@71d5918 FirebirdSQL/fbt-repository@de47679

====== Test Details ======

See test for CORE5667.
Two samples from here were added into core_5667.fbt.

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented Nov 6, 2017

Modified by: @mrotteveel

description: For the following query

with CTE as (SELECT column1 from TABLEA T)
select CT.column1 from CTE CT

isc_info_sql_relation_alias reports an incorrect alias. It reports 'CT T', while 'CT' is expected.

Note that this also applies for all variants with/without an explicit alias, for example

with CTE as (SELECT column1 from TABLEA)
select column1 from CTE

will report 'CTE TABLEA' instead of 'CTE'

This is especially a problem if you use the alias information to generate enhancements for a base query (see JDBC513).

=>

For the following query

with CTE as (SELECT column1 from TABLEA T)
select CT.column1 from CTE CT

isc_info_sql_relation_alias reports an incorrect alias. It reports 'CT T', while 'CT' is expected.

Note that this also applies for all variants with/without an explicit alias, for example

with CTE as (SELECT column1 from TABLEA)
select column1 from CTE

will report 'CTE TABLEA' instead of 'CTE'

And for nested queries, eg

select * from (select column1 from tablea t) d

will return an alias 'd t' instead of 't'.

This is especially a problem if you use the alias information to generate enhancements for a base query (see JDBC513).

summary: isc_info_sql_relation_alias reports incorrect alias for CTE => isc_info_sql_relation_alias reports incorrect alias for CTE or nested queryies

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented Nov 6, 2017

Modified by: @mrotteveel

description: For the following query

with CTE as (SELECT column1 from TABLEA T)
select CT.column1 from CTE CT

isc_info_sql_relation_alias reports an incorrect alias. It reports 'CT T', while 'CT' is expected.

Note that this also applies for all variants with/without an explicit alias, for example

with CTE as (SELECT column1 from TABLEA)
select column1 from CTE

will report 'CTE TABLEA' instead of 'CTE'

And for nested queries, eg

select * from (select column1 from tablea t) d

will return an alias 'd t' instead of 't'.

This is especially a problem if you use the alias information to generate enhancements for a base query (see JDBC513).

=>

For the following query

with CTE as (SELECT column1 from TABLEA T)
select CT.column1 from CTE CT

isc_info_sql_relation_alias reports an incorrect alias. It reports 'CT T', while 'CT' is expected.

Note that this also applies for all variants with/without an explicit alias, for example

with CTE as (SELECT column1 from TABLEA)
select column1 from CTE

will report 'CTE TABLEA' instead of 'CTE'

And for nested queries, eg

select * from (select column1 from tablea t) d

will return an alias 'd t' instead of 'd'.

This is especially a problem if you use the alias information to generate enhancements for a base query (see JDBC513).

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented Nov 6, 2017

Commented by: @mrotteveel

Interestingly, if you take it one level deeper, then you lose the alias information entirely, eg for

select e.column1 from (select d.column1 from (select t.column1 from tablea t) d) e

it reports an empty string ('') as the table alias of the first column.

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented Nov 6, 2017

Modified by: @mrotteveel

summary: isc_info_sql_relation_alias reports incorrect alias for CTE or nested queryies => isc_info_sql_relation_alias reports incorrect alias for CTE or nested queries

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented Nov 6, 2017

Modified by: @mrotteveel

Link: This issue is duplicated by JDBC513 [ JDBC513 ]

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented Dec 3, 2017

Modified by: @hvlad

assignee: Vlad Khorsun [ hvlad ]

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented Dec 3, 2017

Commented by: @hvlad

Patch is committed into master.
Mark, could you verify it, please ?

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented Dec 4, 2017

Commented by: @mrotteveel

Vlad, I tested it against Firebird 4.0.0.825-0_x64 and it works OK.

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented Dec 4, 2017

Modified by: @hvlad

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

resolution: Fixed [ 1 ]

Fix Version: 3.0.3 [ 10810 ]

Fix Version: 4.0 Beta 1 [ 10750 ]

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented Dec 4, 2017

Commented by: @mrotteveel

Will this also be backported to 2.5.x?

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented Dec 5, 2017

Commented by: @hvlad

Looking into it

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented Dec 6, 2017

Commented by: @hvlad

Mark,
please, check next snapshot build of v2.5

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented Dec 9, 2017

Commented by: @mrotteveel

Tested against 2.5.8.27082-0_x64 works OK to.

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented Dec 9, 2017

Commented by: @mrotteveel

Also tested against 3.0.3.32852-0_x64, and works OK to.

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented Dec 9, 2017

Commented by: @hvlad

Thanks

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented Dec 9, 2017

Modified by: @hvlad

Version: 3.0.1 [ 10730 ]

Version: 2.5.6 [ 10721 ]

Version: 3.0.0 [ 10740 ]

Version: 4.0 Initial [ 10621 ]

Version: 2.5.5 [ 10670 ]

Version: 2.5.4 [ 10585 ]

Version: 2.5.3 Update 1 [ 10650 ]

Version: 2.1.7 [ 10651 ]

Version: 2.5.3 [ 10461 ]

Version: 2.5.2 Update 1 [ 10521 ]

Version: 2.5.2 [ 10450 ]

Version: 2.5.1 [ 10333 ]

Version: 2.5.0 [ 10221 ]

Fix Version: 2.5.8 [ 10809 ]

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented Dec 23, 2017

Modified by: @pavel-zotov

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

QA Status: No test => Covered by another test(s)

Test Details: See test for CORE5667

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented Dec 23, 2017

Modified by: @pavel-zotov

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

Test Details: See test for CORE5667 => See test for CORE5667.
Two samples from here were added into core_5667.fbt.

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented Dec 23, 2017

Modified by: @pavel-zotov

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

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