-
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: Internal Executor does not work properly with Virtual Index #71414
Comments
this isn't a bug - this is an unfinished implementation! you need to also implement how a index works in this case: cockroach/pkg/sql/virtual_schema.go Line 110 in e08166a
|
looks like this actually was always broken since 0bcddba. (the INDEX was added without being implemented. there probably should be some validation that disallows that...) confirmed that it's broken in 21.1, so i'm actually going to re-open this and fix.
|
ooof |
Problem
When including the INDEX field when defining virtual schema tables in crdb_internal.go and calling it through a built-in, it causes a panic
To Reproduce
create type greeting as enum ('hi');
SHOW CREATE ALL TYPES;
Expected behavior
This should not panic since the enums are being properly populated
Additional data / screenshots
panic: runtime error: index out of range [0] with length 0 [recovered]
panic: runtime error: index out of range [0] with length 0
goroutine 7396 [running]:
github.com/cockroachdb/cockroach/pkg/util/stop.(*Stopper).Recover(0xc0009ec090, {0x99ef238, 0xc001288740})
/Users/jackwu/go/src/github.com/cockroachdb/cockroach/pkg/util/stop/stopper.go:254 +0xaa
panic({0x80e4e40, 0xc001568360})
/usr/local/opt/go/libexec/src/runtime/panic.go:1038 +0x215
github.com/cockroachdb/cockroach/pkg/sql.virtualSchemaTable.getIndex(...)
/Users/jackwu/go/src/github.com/cockroachdb/cockroach/pkg/sql/virtual_schema.go:220
github.com/cockroachdb/cockroach/pkg/sql.(*virtualDefEntry).makeConstrainedRowsGenerator.func1({0x99555e0, 0xc000674400})
/Users/jackwu/go/src/github.com/cockroachdb/cockroach/pkg/sql/virtual_schema.go:628 +0x7f9
github.com/cockroachdb/cockroach/pkg/sql.setupGenerator.func3({0x99ef238, 0xc001288740})
/Users/jackwu/go/src/github.com/cockroachdb/cockroach/pkg/sql/virtual_table.go:120 +0x130
github.com/cockroachdb/cockroach/pkg/util/stop.(*Stopper).RunAsyncTaskEx.func2()
/Users/jackwu/go/src/github.com/cockroachdb/cockroach/pkg/util/stop/stopper.go:491 +0x12a
created by github.com/cockroachdb/cockroach/pkg/util/stop.(*Stopper).RunAsyncTaskEx
/Users/jackwu/go/src/github.com/cockroachdb/cockroach/pkg/util/stop/stopper.go:481 +0x445
Environment:
cockroach sql
, JDBC, ...]Additional context
What was the impact?
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: