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

how can use "with xx select" syntax #1331

Closed
ftlynx opened this issue Sep 6, 2021 · 4 comments
Closed

how can use "with xx select" syntax #1331

ftlynx opened this issue Sep 6, 2021 · 4 comments

Comments

@ftlynx
Copy link

ftlynx commented Sep 6, 2021

Question

func Parse(sql string) (*ast.StmtNode, error) { p := parser.New() stmtNode, err := p.ParseOneStmt(sql, "", "") if err != nil { return nil, err } return &stmtNode, nil }

sql: with tmp_table as (select * from t1) select * from tmp_table
result:
syntax error

@kennytm
Copy link
Contributor

kennytm commented Sep 6, 2021

hi. which version of pingcap/parser are you using?

@ftlynx
Copy link
Author

ftlynx commented Sep 6, 2021

version: v4.0.2

MacBook-Pro:~ ftlynx$ cat go.mod | grep ping
github.com/pingcap/parser v0.0.0-20200623164729-3a18f1e5dceb
github.com/pingcap/tidb v1.1.0-beta.0.20200630082100-328b6d0a955c

@kennytm
Copy link
Contributor

kennytm commented Sep 6, 2021

CTE parser was implemented in #1207 & #1217, you'll need a parser version of at least 20210429.

@ftlynx
Copy link
Author

ftlynx commented Sep 6, 2021

thanks

@kennytm kennytm closed this as completed Sep 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants