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.