Closed DrewKimball closed 3 weeks ago
Hi @DrewKimball, please add branch-* labels to identify which branch(es) this C-bug affects.
:owl: Hoot! I am a Blathers, a bot for CockroachDB. My owner is dev-inf.
This has been fixed by #126555.
Nevermind, this is still relevant. The reason it still reproduces even with the fix is that the index expression is of the enum type.
This is coming from the WHERE clause in the query to count usages: https://github.com/cockroachdb/cockroach/blob/b1402788998f107bce90f298ee30c25c4084ac0d/pkg/sql/type_change.go#L956
We are trying to reference the index expression, which isn't accessible. We might need to cheat a bit a make the columns accessible internally, like index validation: https://github.com/cockroachdb/cockroach/blob/b1402788998f107bce90f298ee30c25c4084ac0d/pkg/sql/backfill.go#L2095
re-opening until backports are complete
When a table has an expression index (like
INDEX ((x * 100))
), CRDB adds a hiddencrdb_internal_index_expr
column to the table. The logic that checks for usages of an enum value before that value can be dropped does not know how to handle this, which results in an error:This particular bug has likely existed since v21.2 when expression indexes were introduced. There may be other similar bugs due to hidden columns.
Jira issue: CRDB-40295
Epic CRDB-37763