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

sql: CTAS on crdb_internal.jobs table panics #105887

Closed
chengxiong-ruan opened this issue Jun 30, 2023 · 0 comments · Fixed by #105892
Closed

sql: CTAS on crdb_internal.jobs table panics #105887

chengxiong-ruan opened this issue Jun 30, 2023 · 0 comments · Fixed by #105892
Assignees
Labels
C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior. T-sql-foundations SQL Foundations Team (formerly SQL Schema + SQL Sessions)

Comments

@chengxiong-ruan
Copy link
Contributor

chengxiong-ruan commented Jun 30, 2023

Describe the problem
CTAS statements querying from crdb_internal.jobs table crashes with error:

runtime error: invalid memory address or nil pointer dereference
(1) attached stack trace
  -- stack trace:
  | runtime.gopanic
  | 	GOROOT/src/runtime/panic.go:884
  | runtime.panicmem
  | 	GOROOT/src/runtime/panic.go:260
  | runtime.sigpanic
  | 	GOROOT/src/runtime/signal_unix.go:835
  | github.com/cockroachdb/cockroach/pkg/sql.(*txnJobsCollection).numToCreate
  | 	github.com/cockroachdb/cockroach/pkg/sql/jobs_collection.go:70
  | github.com/cockroachdb/cockroach/pkg/sql.makeJobsTableRows
  | 	github.com/cockroachdb/cockroach/pkg/sql/crdb_internal.go:1216
  | github.com/cockroachdb/cockroach/pkg/sql.glob..func39
  | 	github.com/cockroachdb/cockroach/pkg/sql/crdb_internal.go:1176
  | github.com/cockroachdb/cockroach/pkg/sql.(*virtualDefEntry).getPlanInfo.func1.1
  | 	github.com/cockroachdb/cockroach/pkg/sql/virtual_schema.go:678
  | github.com/cockroachdb/cockroach/pkg/sql.setupGenerator.func3
  | 	github.com/cockroachdb/cockroach/pkg/sql/virtual_table.go:127
  | github.com/cockroachdb/cockroach/pkg/util/stop.(*Stopper).RunAsyncTaskEx.func2
  | 	github.com/cockroachdb/cockroach/pkg/util/stop/stopper.go:470
  | runtime.goexit
  | 	GOROOT/src/runtime/asm_amd64.s:1594
Wraps: (2) runtime error: invalid memory address or nil pointer dereference
Error types: (1) *withstack.withStack (2) runtime.errorString

To Reproduce
just run CREATE MATERIALIZED VIEW v AS SELECT * FROM [SHOW JOBS]; or CREATE TABLE t AS SELECT * FROM [SHOW JOBS];

Expected behavior
Create materialized view as expected and no panic.

Environment:

  • any crdb version after 23.1

Jira issue: CRDB-29258

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. T-sql-foundations SQL Foundations Team (formerly SQL Schema + SQL Sessions)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant