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

sqlparser: confusing error message (keyword used as identifier) #17458

Open
xxchan opened this issue Jun 26, 2024 · 5 comments · May be fixed by #19022
Open

sqlparser: confusing error message (keyword used as identifier) #17458

xxchan opened this issue Jun 26, 2024 · 5 comments · May be fixed by #19022
Labels

Comments

@xxchan
Copy link
Member

xxchan commented Jun 26, 2024

WITH arr AS (SELECT header_col_combined FROM additional_columns),
WITH unnested AS (SELECT unnest(header_col_combined) FROM arr)
select * from unnested group by 1;


ERROR:  Failed to run the query

Caused by:
  sql parser error: expected AS, found: unnested
LINE 2: WITH unnested AS (SELECT unnest(header_col_combined) FROM arr)
             ^

should be: unexpected WITH

@xxchan xxchan changed the title confusing error message sqlparser: confusing error message Jun 26, 2024
@github-actions github-actions bot added this to the release-1.10 milestone Jun 26, 2024
@xxchan xxchan changed the title sqlparser: confusing error message sqlparser: confusing error message (keyword used as identifier) Jun 26, 2024
@xxchan xxchan added the good first issue Good for newcomers label Jul 10, 2024
@xxchan xxchan removed this from the release-1.10 milestone Jul 10, 2024
Copy link
Contributor

This issue has been open for 60 days with no activity.

If you think it is still relevant today, and needs to be done in the near future, you can comment to update the status, or just manually remove the no-issue-activity label.

You can also confidently close this issue as not planned to keep our backlog clean.
Don't worry if you think the issue is still valuable to continue in the future.
It's searchable and can be reopened when it's time. 😄

@chagelo
Copy link
Contributor

chagelo commented Sep 15, 2024

create table with; is ok, but here with arr_a as (select * from table_name), with as (select * from table_name) select * from with;, the second with should be identified as a keyword?

In addition, there are some other errors.

select *, select * from a;
ERROR:  Failed to run the query

Caused by:
  sql parser error: syntax error at or near from at line 1, column 20
LINE 1: select *, select * from a;
                                ^
select *, from from a;
ERROR:  Failed to run the query

Caused by:
  sql parser error: syntax error at or near from at line 1, column 11
LINE 1: select *, from from a;
                       ^

I think they are caused by that we don't correctly resolve the tokens followed by comma.

@chagelo
Copy link
Contributor

chagelo commented Oct 13, 2024

@xxchan I mean, create table with is OK(table name), here with is keyword but identified as a identifier, but you say that should be: unexpected WITH, it means with should not be identified as a identifier(column name), it's not reasonable. So I think the error message is fine.

@xxchan
Copy link
Member Author

xxchan commented Oct 13, 2024

create table with is OK(table name), here with is keyword but identified as a identifier

What do you mean by: it's ok to use with as an idendifier?

e.g., in postgres, this will fail:

xxchan@/tmp:postgres> create table with(x int);
syntax error at or near "with"
LINE 1: create table with(x int)

(Also note that create table "with"(x int); is OK.)

If you mean this is the current behavior of RisingWave, I think we can definitely change that.

@chagelo
Copy link
Contributor

chagelo commented Oct 13, 2024

Oh, I got you, thanks.

@chagelo chagelo linked a pull request Oct 19, 2024 that will close this issue
9 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants