-
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
import: v23.1.13: ReturnType called on TypedExpr with empty typeAnnotation on a subquery #117724
Labels
C-bug
Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior.
O-sentry
Originated from an in-the-wild panic report.
P-2
Issues/test failures with a fix SLA of 3 months
T-sql-queries
SQL Queries Team
Comments
This is another location where we call cockroach/pkg/sql/importer/read_import_pgdump.go Lines 784 to 796 in cc4fdff
|
craig bot
pushed a commit
that referenced
this issue
Feb 2, 2024
118569: importer: disallow subqueries in function arguments for pg_dump r=DrewKimball a=DrewKimball Some functions can modify the db schema, and so can be included in a pg_dump file. The pg_dump importer logic type-checks such functions, which can lead to a nil-pointer panic in cases like the following: `SELECT addgeometrycolumn('t', 'foo', 4326, (SELECT 'POINT'), 2)` This is because subqueries cannot be type-checked outside the optbuilder, which sets the type annotation for the subquery. This patch explicitly disallows subqueries in the type-checking that happens for processing a pg_dump file. This will ensure that users get an expected `subqueries are not allowed in pg_dump function arguments` error, instead of the panic. Fixes #117724 Release note (bug fix): Fixed a rare panic that could happen during a pg_dump import that contains a function like `SELECT addgeometrycolumn(...)`. Now, attempting to import a pg_dump with a function that has a subquery in one of its arguments results in an expected error. Co-authored-by: Drew Kimball <drewk@cockroachlabs.com>
blathers-crl bot
pushed a commit
that referenced
this issue
Feb 2, 2024
Some functions can modify the db schema, and so can be included in a pg_dump file. The pg_dump importer logic type-checks such functions, which can lead to a nil-pointer panic in cases like the following: `SELECT addgeometrycolumn('t', 'foo', 4326, (SELECT 'POINT'), 2)` This is because subqueries cannot be type-checked outside the optbuilder, which sets the type annotation for the subquery. This patch explicitly disallows subqueries in the type-checking that happens for processing a pg_dump file. This will ensure that users get an expected `subqueries are not allowed in pg_dump function arguments` error, instead of the panic. Fixes #117724 Release note (bug fix): Fixed a rare panic that could happen during a pg_dump import that contains a function like `SELECT addgeometrycolumn(...)`. Now, attempting to import a pg_dump with a function that has a subquery in one of its arguments results in an expected error.
blathers-crl bot
pushed a commit
that referenced
this issue
Feb 2, 2024
Some functions can modify the db schema, and so can be included in a pg_dump file. The pg_dump importer logic type-checks such functions, which can lead to a nil-pointer panic in cases like the following: `SELECT addgeometrycolumn('t', 'foo', 4326, (SELECT 'POINT'), 2)` This is because subqueries cannot be type-checked outside the optbuilder, which sets the type annotation for the subquery. This patch explicitly disallows subqueries in the type-checking that happens for processing a pg_dump file. This will ensure that users get an expected `subqueries are not allowed in pg_dump function arguments` error, instead of the panic. Fixes #117724 Release note (bug fix): Fixed a rare panic that could happen during a pg_dump import that contains a function like `SELECT addgeometrycolumn(...)`. Now, attempting to import a pg_dump with a function that has a subquery in one of its arguments results in an expected error.
wenyihu6
pushed a commit
to wenyihu6/cockroach
that referenced
this issue
Feb 21, 2024
Some functions can modify the db schema, and so can be included in a pg_dump file. The pg_dump importer logic type-checks such functions, which can lead to a nil-pointer panic in cases like the following: `SELECT addgeometrycolumn('t', 'foo', 4326, (SELECT 'POINT'), 2)` This is because subqueries cannot be type-checked outside the optbuilder, which sets the type annotation for the subquery. This patch explicitly disallows subqueries in the type-checking that happens for processing a pg_dump file. This will ensure that users get an expected `subqueries are not allowed in pg_dump function arguments` error, instead of the panic. Fixes cockroachdb#117724 Release note (bug fix): Fixed a rare panic that could happen during a pg_dump import that contains a function like `SELECT addgeometrycolumn(...)`. Now, attempting to import a pg_dump with a function that has a subquery in one of its arguments results in an expected error.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
C-bug
Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior.
O-sentry
Originated from an in-the-wild panic report.
P-2
Issues/test failures with a fix SLA of 3 months
T-sql-queries
SQL Queries Team
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/4853567853/?referrer=webhooks_plugin
Panic Message:
Stacktrace (expand for inline code snippets):
GOROOT/src/runtime/asm_amd64.s#L1593-L1595
cockroach/pkg/util/stop/stopper.go
Lines 469 to 471 in 8d065df
cockroach/pkg/jobs/jobs.go
Lines 977 to 979 in 8d065df
cockroach/pkg/jobs/adopt.go
Lines 473 to 475 in 8d065df
cockroach/pkg/jobs/registry.go
Lines 1630 to 1632 in 8d065df
cockroach/pkg/jobs/registry.go
Lines 1629 to 1631 in 8d065df
cockroach/pkg/sql/importer/import_job.go
Lines 112 to 114 in 8d065df
cockroach/pkg/sql/importer/import_job.go
Lines 780 to 782 in 8d065df
cockroach/pkg/sql/importer/import_job.go
Lines 910 to 912 in 8d065df
cockroach/pkg/sql/importer/read_import_pgdump.go
Lines 512 to 514 in 8d065df
cockroach/pkg/sql/importer/read_import_pgdump.go
Lines 786 to 788 in 8d065df
cockroach/pkg/sql/sem/tree/type_check.go
Lines 1080 to 1082 in 8d065df
cockroach/pkg/sql/sem/tree/overload.go
Lines 841 to 843 in 8d065df
cockroach/pkg/sql/sem/tree/type_check.go
Lines 319 to 321 in 8d065df
cockroach/pkg/sql/sem/tree/overload.go
Lines 841 to 843 in 8d065df
cockroach/pkg/sql/sem/tree/type_check.go
Lines 1502 to 1504 in 8d065df
cockroach/pkg/sql/sem/tree/expr.go
Lines 151 to 153 in 8d065df
GOROOT/src/runtime/panic.go#L883-L885
GOROOT/src/runtime/asm_amd64.s#L1593-L1595
cockroach/pkg/util/stop/stopper.go
Lines 469 to 471 in 8d065df
cockroach/pkg/jobs/jobs.go
Lines 977 to 979 in 8d065df
cockroach/pkg/jobs/adopt.go
Lines 473 to 475 in 8d065df
cockroach/pkg/jobs/registry.go
Lines 1630 to 1632 in 8d065df
cockroach/pkg/jobs/registry.go
Lines 1629 to 1631 in 8d065df
cockroach/pkg/sql/importer/import_job.go
Lines 112 to 114 in 8d065df
cockroach/pkg/sql/importer/import_job.go
Lines 780 to 782 in 8d065df
cockroach/pkg/sql/importer/import_job.go
Lines 910 to 912 in 8d065df
cockroach/pkg/sql/importer/read_import_pgdump.go
Lines 512 to 514 in 8d065df
cockroach/pkg/sql/importer/read_import_pgdump.go
Lines 786 to 788 in 8d065df
cockroach/pkg/sql/sem/tree/type_check.go
Lines 1080 to 1082 in 8d065df
cockroach/pkg/sql/sem/tree/overload.go
Lines 841 to 843 in 8d065df
cockroach/pkg/sql/sem/tree/type_check.go
Lines 319 to 321 in 8d065df
cockroach/pkg/sql/sem/tree/overload.go
Lines 841 to 843 in 8d065df
cockroach/pkg/sql/sem/tree/type_check.go
Lines 1502 to 1504 in 8d065df
cockroach/pkg/sql/sem/tree/expr.go
Lines 151 to 153 in 8d065df
Tags
Jira issue: CRDB-35321
The text was updated successfully, but these errors were encountered: