You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When call getTableAlias() is called on a sql with CTE, wrong table alias is returned.
When sql is created, to the tableAlias is inserted alias with space and when "where" is added, exception is thrown because of space.
The final table alias is created by joining both table aliases (from common table expression and from select).
insert into tableA(column1, column2) values('test','some text');
insert into tableA(column1, column2) values('test2','some text2');
insert into tableA(column1, column2) values('test3','some text3');
with CTE as (SELECT column1 from TABLEA T)
select CT.column1 from CTE CT
SQL error code = -104
Token unknown - line 4, column 11
T
with CTE as ( select column1 from tableA T)
select CT.column1
from CTE CT
where (CT T.COLUMN1 starting 'test')
The text was updated successfully, but these errors were encountered:
I can reproduce this. The method `getTableAlias` uses the alias information provided by Firebird (in information element isc_info_sql_relation_alias), so it is a bug in Firebird itself .
I will see if this has already been reported in the CORE project, or otherwise I'll create a ticket there.
Reported this as CORE5655. Note that the problem is not limited to CTEs, it will do the same for nested table expressions like select * from (select column1 from tablea t) d
Submitted by: Mark (mareczek55)
Duplicates CORE5655
When call getTableAlias() is called on a sql with CTE, wrong table alias is returned.
When sql is created, to the tableAlias is inserted alias with space and when "where" is added, exception is thrown because of space.
The final table alias is created by joining both table aliases (from common table expression and from select).
Here is a simple example:
create table tableA(
column1 varchar(20),
column2 varchar(20)
);
insert into tableA(column1, column2) values('test','some text');
insert into tableA(column1, column2) values('test2','some text2');
insert into tableA(column1, column2) values('test3','some text3');
with CTE as (SELECT column1 from TABLEA T)
select CT.column1 from CTE CT
SQL error code = -104
Token unknown - line 4, column 11
T
with CTE as ( select column1 from tableA T)
select CT.column1
from CTE CT
where (CT T.COLUMN1 starting 'test')
The text was updated successfully, but these errors were encountered: