Select `cte.field_name` not working with UNION CTE
- Dominant language
- Rust
- Stars
- 20.8k
- Forks
- 2.1k
- Avg merge
- 1d 2h
- Merged PRs (30d)
- 181
Description
**Failed SQL**
```SQL
WITH test AS (
SELECT
name
FROM
cities
UNION
SELECT
name
FROM
countries
)
SELECT
test.name
from
test;
```
**Logical Plan**
`Initial planning error: Error during planning: No field named 'test.name'. Valid fields are 'name'.`
**Version:**
0.34.52
**Additional context**
Hi team, I was trying to query this to Cube SQL API and got this error.
Looks like there is a bug/unimplemented use case within the planning stage.
Some more context:
- I have 2 cube instances, 1 is `cities` and the other is `countries`, both have `name` attributes.
- I was trying to union these 2 tables and then select name property from the CTE `test` and get this error
- Yes, I have tried `SELECT name from test` and it works, but `test.name` shouldn't fail since this is valid in PostgreSQL
Please let me know if there is anything wrong, thanks a lot team.
Contributor guide
Assessment
This issue has not been assessed yet.