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 or Table Creation Runtime Error #2479

Closed
shauryauppal opened this issue Oct 23, 2021 · 8 comments
Closed

View or Table Creation Runtime Error #2479

shauryauppal opened this issue Oct 23, 2021 · 8 comments
Labels

Comments

@shauryauppal
Copy link

What happens?

Facing runtime error: "RuntimeError: Parser Error: Expected a single SELECT statement"

It is clearly visible in the screenshot below that there is only one SELECT statement in the query then why is this error showing up. I am on duckdb 0.3.0

Screenshot 2021-10-23 at 11 41 05 PM

To Reproduce

Create a Table view T1 then apply some operation on T1 then create a table view of processed_T1 to get the resultant T2 view.
T2 view over-processed T1 view will fail.

Environment (please complete the following information)

  • OS: Mac
  • DuckDB Version: 0.3.0
  • DuckDB Client: Python
@shauryauppal
Copy link
Author

Screenshot 2021-10-23 at 11 49 05 PM
Screenshot 2021-10-23 at 11 49 16 PM

Same Error Message when I try to CREATE TABLE or CREATE VIEW

@Mytherin
Copy link
Collaborator

con.query creates a Relation node from a select statement (equivalent to a subquery node), it’s not intended for running arbitrary SQL statements. The error message there should be clearer. You are probably looking for con.execute.

@shauryauppal
Copy link
Author

" SELECT * from product_view_tbl where session_event_ct!=-1" Query as such is working but CREATE TABLE over that query is giving Runtimeerror.

@shauryauppal
Copy link
Author

con.execute vs con.query was really helpful.

I had one more question check the below screenshot. Here the first method fails why? Ideally, it should work.
Screenshot 2021-10-24 at 12 02 26 AM

@Mytherin

@Mytherin
Copy link
Collaborator

CTEs in views are not supported, and do not appear to be supported in most systems (e.g. this also doesn't appear to work in Postgres, MySQL or SQLite). Feel free to open a feature request for this.

@l1t1

This comment was marked as abuse.

@github-actions
Copy link

github-actions bot commented Aug 1, 2023

This issue is stale because it has been open 90 days with no activity. Remove stale label or comment or this will be closed in 30 days.

@github-actions github-actions bot added the stale label Aug 1, 2023
@github-actions
Copy link

github-actions bot commented Sep 1, 2023

This issue was closed because it has been stale for 30 days with no activity.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Sep 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants