Unexpected column alias for CTEs


#1

In a query doing a select * from a CTE the original column aliases “leak” through. So in the following query:

with t(f1) as (select 1 a from dual) select * from t;

the result metadata has the column alias ‘a’:

a|
-|
1|

This is unexpected. Replacing the ‘*’ with the column alias yields the expected result:

with t(f1) as (select 1 a from dual) select f1 from t;

Please also note that this behavior is different from MySQL.


#2

This looks like a bug. I’ve a filed a task internally to track fixing this and will update here when it is. Thanks for pointing this out.