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

View cannot find column while materialized view can #6801

Closed
lmatz opened this issue Dec 8, 2022 · 2 comments · Fixed by #6817
Closed

View cannot find column while materialized view can #6801

lmatz opened this issue Dec 8, 2022 · 2 comments · Fixed by #6817
Labels
type/bug Something isn't working

Comments

@lmatz
Copy link
Contributor

lmatz commented Dec 8, 2022

Describe the bug

dev=> create table t1 (s struct<v1 int, v2 VARCHAR>);
CREATE_TABLE
dev=> create materialized view mv2 as select (s).v1, (s).v2 from t1;
CREATE_MATERIALIZED_VIEW
dev=> select count(*) from mv2;
 ?column? 
----------
        0
(1 row)

dev=> create view v2 as select (s).v1, (s).v2 from t1;
CREATE_VIEW
dev=> select count(*) from v2;
ERROR:  QueryError: Bind error: failed to bind view v2, sql: SELECT s.v1, s.v2 FROM t1
error: Item not found: Invalid column: v1

To Reproduce

No response

Expected behavior

No response

Additional context

No response

@lmatz lmatz added the type/bug Something isn't working label Dec 8, 2022
@github-actions github-actions bot added this to the release-0.1.15 milestone Dec 8, 2022
@BugenZhao
Copy link
Member

I guess this is caused by the incorrect "unparse" in sql parser. Maybe directly storing the original SQL input by the user will be a solution?

sql: format!("{}", query),

@BowenXiao1999
Copy link
Contributor

This will be a blocker for #6849. Cuz here we assuming the original sql str is just one statement, however it may not be true. Have to do some if-else hack to support #6849.

Seems like #6940 can fix problem

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants