-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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: v23.1.8-custom: parentheses is badly nested in ParseAndCollectTelemetryForPLpgSQLFunc #109342
Comments
cockroach-sentry
added
O-sentry
Originated from an in-the-wild panic report.
C-bug
Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior.
labels
Aug 23, 2023
yuzefovich
changed the title
Sentry: lexer.go:316: parentheses is badly nested
(1) assertion failure
Wraps: (2) attached stack trace
-- stack trace:
| github.com/cockroachdb/cockroach/pkg/sql/plpgsql/parser.(*lexer).ReadSqlCo...
sql: v23.1.8-custom: parentheses is badly nested in ParseAndCollectTelemetryForPLpgSQLFunc
Aug 23, 2023
This looks like a syntax error that is being incorrect raised as an internal error and not a user error. |
DrewKimball
added a commit
to DrewKimball/cockroach
that referenced
this issue
Oct 11, 2023
Previously, the PLpgSQL parser could panic when the user supplied more than one expression in a location where only one was expected, for example, in a return statement. This was because the PLpgSQL parser delegated to the SQL parser's `ParseExpr` function, which expects exactly one input expression. This commit returns a syntax error instead of the panic by switching to use `ParseExprs`, which can handle multiple input expressions. Informs cockroachdb#109342 Release note: None
DrewKimball
added a commit
to DrewKimball/cockroach
that referenced
this issue
Oct 11, 2023
…ression This patch fixes error messages in the PLpgSQL parser for the case when the parenthesis nesting is invalid, and for the case when no expression (or statement) is supplied. Previously, invalid parentheses would cause a panic without an error code, and a missing expression had the incorrect message, since it wasn't checked until the SQL parser attempted to read an empty string. Now, both cases are checked immediately by the PLpgSQL parser and the correct error is propagated. Fixes cockroachdb#109342 Release note: None
DrewKimball
added a commit
to DrewKimball/cockroach
that referenced
this issue
Oct 16, 2023
Previously, the PLpgSQL parser could panic when the user supplied more than one expression in a location where only one was expected, for example, in a return statement. This was because the PLpgSQL parser delegated to the SQL parser's `ParseExpr` function, which expects exactly one input expression. This commit returns a syntax error instead of the panic by switching to use `ParseExprs`, which can handle multiple input expressions. Informs cockroachdb#109342 Release note: None
craig bot
pushed a commit
that referenced
this issue
Oct 17, 2023
112200: plpgsql: correctly handle parsing errors r=DrewKimball a=DrewKimball #### plpgsql: correctly handle parsing errors This patch ensures that PLpgSQL parsing errors are correctly propagated in all cases. Previously, there were a few cases (like variable declaration type parsing) where an error didn't halt parsing. The contract for `GetTypeFromValidSQLSyntax` is also clarified, since it is ok to call with an invalid type name as long as the error is properly handled. Informs #105254 Release note: None #### plpgsql: handle multiple expressions when one expression is expected Previously, the PLpgSQL parser could panic when the user supplied more than one expression in a location where only one was expected, for example, in a return statement. This was because the PLpgSQL parser delegated to the SQL parser's `ParseExpr` function, which expects exactly one input expression. This commit returns a syntax error instead of the panic by switching to use `ParseExprs`, which can handle multiple input expressions. Informs #109342 Release note: None #### plpgsql: return correct error for invalid parantheses and missing expression This patch fixes error messages in the PLpgSQL parser for the case when the parenthesis nesting is invalid, and for the case when no expression (or statement) is supplied. Previously, invalid parentheses would cause a panic without an error code, and a missing expression had the incorrect message, since it wasn't checked until the SQL parser attempted to read an empty string. Now, both cases are checked immediately by the PLpgSQL parser and the correct error is propagated. Fixes #109342 Release note: None Co-authored-by: Drew Kimball <[email protected]>
blathers-crl bot
pushed a commit
that referenced
this issue
Oct 17, 2023
Previously, the PLpgSQL parser could panic when the user supplied more than one expression in a location where only one was expected, for example, in a return statement. This was because the PLpgSQL parser delegated to the SQL parser's `ParseExpr` function, which expects exactly one input expression. This commit returns a syntax error instead of the panic by switching to use `ParseExprs`, which can handle multiple input expressions. Informs #109342 Release note: None
blathers-crl bot
pushed a commit
that referenced
this issue
Oct 17, 2023
…ression This patch fixes error messages in the PLpgSQL parser for the case when the parenthesis nesting is invalid, and for the case when no expression (or statement) is supplied. Previously, invalid parentheses would cause a panic without an error code, and a missing expression had the incorrect message, since it wasn't checked until the SQL parser attempted to read an empty string. Now, both cases are checked immediately by the PLpgSQL parser and the correct error is propagated. Fixes #109342 Release note: None
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This issue was auto filed by Sentry. It represents a crash or reported error on a live cluster with telemetry enabled.
Sentry Link: https://cockroach-labs.sentry.io/issues/4415320627/?referrer=webhooks_plugin
Panic Message:
Stacktrace (expand for inline code snippets):
GOROOT/src/runtime/asm_amd64.s#L1593-L1595
cockroach/pkg/sql/pgwire/conn.go
Lines 309 to 311 in c2fa404
cockroach/pkg/sql/conn_executor.go
Lines 899 to 901 in c2fa404
cockroach/pkg/sql/conn_executor.go
Lines 2102 to 2104 in c2fa404
cockroach/pkg/sql/conn_executor.go
Lines 2185 to 2187 in c2fa404
cockroach/pkg/sql/conn_executor.go
Lines 2180 to 2182 in c2fa404
cockroach/pkg/sql/conn_executor_exec.go
Lines 140 to 142 in c2fa404
cockroach/pkg/sql/conn_executor_exec.go
Lines 2985 to 2987 in c2fa404
cockroach/pkg/sql/conn_executor_exec.go
Lines 141 to 143 in c2fa404
cockroach/pkg/sql/conn_executor_exec.go
Lines 963 to 965 in c2fa404
cockroach/pkg/sql/conn_executor_exec.go
Lines 1483 to 1485 in c2fa404
cockroach/pkg/sql/conn_executor_exec.go
Lines 1977 to 1979 in c2fa404
cockroach/pkg/sql/plan_opt.go
Lines 239 to 241 in c2fa404
cockroach/pkg/sql/plan_opt.go
Lines 575 to 577 in c2fa404
cockroach/pkg/sql/opt/optbuilder/builder.go
Lines 245 to 247 in c2fa404
cockroach/pkg/sql/opt/optbuilder/builder.go
Lines 271 to 273 in c2fa404
cockroach/pkg/sql/opt/optbuilder/builder.go
Lines 358 to 360 in c2fa404
cockroach/pkg/sql/opt/optbuilder/create_function.go
Lines 110 to 112 in c2fa404
cockroach/pkg/sql/sem/plpgsqltree/utils/plpg_visitor.go
Lines 111 to 113 in c2fa404
cockroach/pkg/sql/sem/plpgsqltree/utils/plpg_visitor.go
Lines 89 to 91 in c2fa404
cockroach/pkg/sql/plpgsql/parser/parse.go
Lines 131 to 133 in c2fa404
cockroach/pkg/sql/plpgsql/parser/parse.go
Lines 81 to 83 in c2fa404
cockroach/pkg/sql/plpgsql/parser/parse.go
Lines 97 to 99 in c2fa404
plpgsql-gen.y#L1149-L1151
cockroach/pkg/sql/plpgsql/parser/lexer.go
Lines 276 to 278 in c2fa404
cockroach/pkg/sql/plpgsql/parser/lexer.go
Lines 315 to 317 in c2fa404
Tags
Jira issue: CRDB-30884
The text was updated successfully, but these errors were encountered: