-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
sql: add plpgsql parser for telemetry purposes #98147
Conversation
Could you also rewrite the messages of the existing commits? I believe they are drafts. Thanks! |
3c0cb70
to
019a4af
Compare
The last commit contains lots of rewrites of build.bazel. I think it's because of rebasing. Can we squash it with the first commit (the scaffold one)? |
a92f71d
to
609e6a4
Compare
b4f2eb3
to
4e4d76f
Compare
@ZhouXing19 and @chengxiong-ruan gentle ping to review this PR when you get a chance. Thanks! |
Adds the first test which parses an empty function or function with bare sql queries. Release note: None
This commit adds `lexer.ReadSqlExpressionStr()` which gives access to the return type of a plpgsql function. This commit also adds grammar rules and AST for `stmt_if` Release note: None
This commit adds AST and grammar rules for `decl_header` and `stmt_assert` Release note: None
This commit adds the AST and grammar rules for `stmt_call`, `stmt_close`, `stmt_dynaexec`, and `stmt_exit` Release note: None
This commit adds the AST and grammar rules for `stmt_assign` and `stmt_getdiag` Release note: None
This commit adds portions of the logic to parse `stmt_case`. Does not yet support ELSE, sql statements in THEN body, or END CASE (it uses an ENDCASE hack). Release note: None
This commit corrects the grammar rules for `stmt_case`. Release note: None
This commit corrects the grammar rules and AST of `stmt_if`, `elsif`, `else` statements. Release note: None
This commit adds logic for `stmt_open` Release note: None
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: complete! 0 of 0 LGTMs obtained (waiting on @chengxiong-ruan, @DrewKimball, @knz, @rafiss, and @ZhouXing19)
pkg/sql/sem/plpgsqltree/constants.go
line 16 at r70 (raw file):
Previously, knz (Raphael 'kena' Poss) wrote…
Here and for all the other comments:
- each comment for an individual exported symbol needs to be prefixed by the name of the exported symbol.
- comments contain sentence and thus should end with a period.
Done.
pkg/sql/sem/plpgsqltree/constants.go
line 40 at r70 (raw file):
Previously, knz (Raphael 'kena' Poss) wrote…
String is special - usually we document
// String implements the fmt.Stringer interface.
Done.
pkg/sql/plpgsql/parser/parser_test.go
line 32 at r59 (raw file):
Previously, knz (Raphael 'kena' Poss) wrote…
Would it be possible to define the data driven test framework in 1 place, and us it from both packages?
We will do this at a later date.
Previously, e-mbrown (Ebony Brown) wrote…
Could you file an issue to track or at least a TODO? Thanks. |
This commit makes Statement generic so it can be shared between the sql and plpgsql parsers. Release note: None
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: complete! 0 of 0 LGTMs obtained (waiting on @chengxiong-ruan, @DrewKimball, @knz, @rafiss, and @ZhouXing19)
pkg/sql/plpgsql/parser/parser_test.go
line 32 at r59 (raw file):
data driven test framework
I'll add a TODO for now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Thank you for your patience through this.
Thanks for all the reviews!! bors r+ |
Build succeeded: |
99517: sql: add unimplemented errors and telemetry for plpgsql r=e-mbrown a=e-mbrown Part of: #98147 Closes: #91569 This PR expands grammar rules and adds unimplemented support for pl/pgsql statements. [sql: Add telemetry for parsable plpgsql statements](37aa95d) Is the first commit unique to this PR. Release Notes: None Co-authored-by: Jane Xing <zhouxing@uchicago.edu> Co-authored-by: e-mbrown <ebsonari@gmail.com>
blathers backport 23.1 22.2 |
Encountered an error creating backports. Some common things that can go wrong:
You might need to create your backport manually using the backport tool. error creating merge commit from 9688586 to blathers/backport-release-23.1-98147: POST https://api.github.com/repos/cockroachdb/cockroach/merges: 409 Merge conflict [] you may need to manually resolve merge conflicts with the backport tool. Backport to branch 23.1 failed. See errors above. error creating merge commit from 19b6cb9 to blathers/backport-release-22.2-98147: POST https://api.github.com/repos/cockroachdb/cockroach/merges: 409 Merge conflict [] you may need to manually resolve merge conflicts with the backport tool. Backport to branch 22.2 failed. See errors above. 🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is dev-inf. |
Informs: #91569
This commit adds the in use portions of the plpgsql parser from #91606.
Release note: None