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

Sentry: table_desc_builder.go:1320: referenced descriptor ID 201: table × (201): identity column × (1) on table × must own a sequence (1) Wraps: (2) Wraps: (3) Wraps: (4) Wraps: (5) attached stack ... #138972

Open
cockroach-sentry opened this issue Jan 13, 2025 · 6 comments
Assignees
Labels
branch-release-24.3 Used to mark GA and release blockers, technical advisories, and bugs for 24.3 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. T-sql-foundations SQL Foundations Team (formerly SQL Schema + SQL Sessions) X-blathers-triaged blathers was able to find an owner

Comments

@cockroach-sentry
Copy link
Collaborator

cockroach-sentry commented Jan 13, 2025

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/6217117453/?referrer=webhooks_plugin

Panic Message:

table_desc_builder.go:1320: referenced descriptor ID 201: table × (201): identity column × (1) on table × must own a sequence
(1)
Wraps: (2)
Wraps: (3)
Wraps: (4)
Wraps: (5) attached stack trace
  -- stack trace:
  | github.com/cockroachdb/cockroach/pkg/sql/catalog/internal/catkv.wrapError
  | 	pkg/sql/catalog/internal/catkv/catalog_query.go:168
  | github.com/cockroachdb/cockroach/pkg/sql/catalog/internal/catkv.catalogQuery.processDescriptorResultRow
  | 	pkg/sql/catalog/internal/catkv/catalog_query.go:111
  | github.com/cockroachdb/cockroach/pkg/sql/catalog/internal/catkv.catalogQuery.query
  | 	pkg/sql/catalog/internal/catkv/catalog_query.go:70
  | github.com/cockroachdb/cockroach/pkg/sql/catalog/internal/catkv.catalogReader.GetByIDs
  | 	pkg/sql/catalog/internal/catkv/catalog_reader.go:356
  | github.com/cockroachdb/cockroach/pkg/sql/catalog/internal/catkv.(*cachedCatalogReader).GetByIDs
  | 	pkg/sql/catalog/internal/catkv/catalog_reader_cached.go:357
  | github.com/cockroachdb/cockroach/pkg/sql/catalog/descs.getDescriptorsByID
  | 	pkg/sql/catalog/descs/descriptor.go:202
  | github.com/cockroachdb/cockroach/pkg/sql/catalog/descs.(*Collection).aggregateAllLayers
  | 	pkg/sql/catalog/descs/collection.go:1043
  | github.com/cockroachdb/cockroach/pkg/sql/catalog/descs.(*Collection).GetAllInDatabase
  | 	pkg/sql/catalog/descs/collection.go:886
  | github.com/cockroachdb/cockroach/pkg/sql/catalog/descs.(*Collection).GetAllDescriptorsForDatabase
  | 	pkg/sql/catalog/descs/collection.go:1070
  | github.com/cockroachdb/cockroach/pkg/sql.forEachTableDesc
  | 	pkg/sql/information_schema.go:2649
  | github.com/cockroachdb/cockroach/pkg/sql.makeAllRelationsVirtualTableWithDescriptorIDIndex.func1
  | 	pkg/sql/pg_catalog.go:1179
  | github.com/cockroachdb/cockroach/pkg/sql.(*virtualDefEntry).getPlanInfo.func1.1
  | 	pkg/sql/virtual_schema.go:657
  | github.com/cockroachdb/cockroach/pkg/sql.setupGenerator.func3.1
  | 	pkg/sql/virtual_table.go:138
  | github.com/cockroachdb/cockroach/pkg/sql.setupGenerator.func3
  | 	pkg/sql/virtual_table.go:139
  | github.com/cockroachdb/cockroach/pkg/util/stop.(*Stopper).RunAsyncTaskEx.func2
  | 	pkg/util/stop/stopper.go:498
Wraps: (6) referenced descriptor ID 201
Wraps: (7) attached stack trace
  -- stack trace:
  | github.com/cockroachdb/cockroach/pkg/sql/catalog/tabledesc.(*tableDescriptorBuilder).RunPostDeserializationChanges.func1
  | 	pkg/sql/catalog/tabledesc/table_desc_builder.go:159
  | [...repeated from below...]
Wraps: (8) table × (201)
Wraps: (9) assertion failure
Wraps: (10) attached stack trace
  -- stack trace:
  | github.com/cockroachdb/cockroach/pkg/sql/catalog/tabledesc.maybeFixUsesSequencesIDForIdentityColumns
  | 	pkg/sql/catalog/tabledesc/table_desc_builder.go:1320
  | github.com/cockroachdb/cockroach/pkg/sql/catalog/tabledesc.maybeFillInDescriptor
  | 	pkg/sql/catalog/tabledesc/table_desc_builder.go:517
  | github.com/cockroachdb/cockroach/pkg/sql/catalog/tabledesc.(*tableDescriptorBuilder).RunPostDeserializationChanges
  | 	pkg/sql/catalog/tabledesc/table_desc_builder.go:170
  | github.com/cockroachdb/cockroach/pkg/sql/catalog/descbuilder.fromProtobufAndMVCCTimestamp
  | 	pkg/sql/catalog/descbuilder/desc_builder.go:68
  | github.com/cockroachdb/cockroach/pkg/sql/catalog/descbuilder.FromSerializedValue
  | 	pkg/sql/catalog/descbuilder/desc_builder.go:46
  | github.com/cockroachdb/cockroach/pkg/sql/catalog/internal/catkv.build
  | 	pkg/sql/catalog/internal/catkv/catalog_query.go:176
  | github.com/cockroachdb/cockroach/pkg/sql/catalog/internal/catkv.catalogQuery.processDescriptorResultRow
  | 	pkg/sql/catalog/internal/catkv/catalog_query.go:109
  | github.com/cockroachdb/cockroach/pkg/sql/catalog/internal/catkv.catalogQuery.query
  | 	pkg/sql/catalog/internal/catkv/catalog_query.go:70
  | github.com/cockroachdb/cockroach/pkg/sql/catalog/internal/catkv.catalogReader.GetByIDs
  | 	pkg/sql/catalog/internal/catkv/catalog_reader.go:356
  | github.com/cockroachdb/cockroach/pkg/sql/catalog/internal/catkv.(*cachedCatalogReader).GetByIDs
  | 	pkg/sql/catalog/internal/catkv/catalog_reader_cached.go:357
  | github.com/cockroachdb/cockroach/pkg/sql/catalog/descs.getDescriptorsByID
  | 	pkg/sql/catalog/descs/descriptor.go:202
  | github.com/cockroachdb/cockroach/pkg/sql/catalog/descs.(*Collection).aggregateAllLayers
  | 	pkg/sql/catalog/descs/collection.go:1043
  | github.com/cockroachdb/cockroach/pkg/sql/catalog/descs.(*Collection).GetAllInDatabase
  | 	pkg/sql/catalog/descs/collection.go:886
  | github.com/cockroachdb/cockroach/pkg/sql/catalog/descs.(*Collection).GetAllDescriptorsForDatabase
  | 	pkg/sql/catalog/descs/collection.go:1070
  | github.com/cockroachdb/cockroach/pkg/sql.forEachTableDesc
  | 	pkg/sql/information_schema.go:2649
  | github.com/cockroachdb/cockroach/pkg/sql.makeAllRelationsVirtualTableWithDescriptorIDIndex.func1
  | 	pkg/sql/pg_catalog.go:1179
  | github.com/cockroachdb/cockroach/pkg/sql.(*virtualDefEntry).getPlanInfo.func1.1
  | 	pkg/sql/virtual_schema.go:657
  | github.com/cockroachdb/cockroach/pkg/sql.setupGenerator.func3.1
  | 	pkg/sql/virtual_table.go:138
  | github.com/cockroachdb/cockroach/pkg/sql.setupGenerator.func3
  | 	pkg/sql/virtual_table.go:139
  | github.com/cockroachdb/cockroach/pkg/util/stop.(*Stopper).RunAsyncTaskEx.func2
  | 	pkg/util/stop/stopper.go:498
  | runtime.goexit
  | 	src/runtime/asm_amd64.s:1695
Wraps: (11) identity column × (1) on table × must own a sequence
Error types: (1) *colexecerror.notInternalError (2) *colexecerror.notInternalError (3) *colexecerror.notInternalError (4) *colexecerror.notInternalError (5) *withstack.withStack (6) *errutil.withPrefix (7) *withstack.withStack (8) *errutil.withPrefix (9) *assert.withAssertionFailure (10) *withstack.withStack (11) *errutil.leafError
-- report composition:
*errutil.leafError: identity column × (1) on table × must own a sequence
table_desc_builder.go:1320: *withstack.withStack (top exception)
*assert.withAssertionFailure
*errutil.withPrefix: table × (201)
table_desc_builder.go:159: *withstack.withStack (1)
*errutil.withPrefix: referenced descriptor ID 201
catalog_query.go:168: *withstack.withStack (2)
*colexecerror.notInternalError
*colexecerror.notInternalError
*colexecerror.notInternalError
*colexecerror.notInternalError
(check the extra data payloads)
Stacktrace (expand for inline code snippets):

src/runtime/asm_amd64.s#L1694-L1696
pkg/util/stop/stopper.go#L497-L499
pkg/sql/virtual_table.go#L138-L140
pkg/sql/virtual_table.go#L137-L139
pkg/sql/virtual_schema.go#L656-L658
pkg/sql/pg_catalog.go#L1178-L1180
pkg/sql/information_schema.go#L2648-L2650
pkg/sql/catalog/descs/collection.go#L1069-L1071
pkg/sql/catalog/descs/collection.go#L885-L887
pkg/sql/catalog/descs/collection.go#L1042-L1044
pkg/sql/catalog/descs/descriptor.go#L201-L203
pkg/sql/catalog/internal/catkv/catalog_reader_cached.go#L356-L358
pkg/sql/catalog/internal/catkv/catalog_reader.go#L355-L357
pkg/sql/catalog/internal/catkv/catalog_query.go#L69-L71
pkg/sql/catalog/internal/catkv/catalog_query.go#L110-L112
pkg/sql/catalog/internal/catkv/catalog_query.go#L167-L169
src/runtime/asm_amd64.s#L1694-L1696
pkg/util/stop/stopper.go#L497-L499
pkg/sql/virtual_table.go#L138-L140
pkg/sql/virtual_table.go#L137-L139
pkg/sql/virtual_schema.go#L656-L658
pkg/sql/pg_catalog.go#L1178-L1180
pkg/sql/information_schema.go#L2648-L2650
pkg/sql/catalog/descs/collection.go#L1069-L1071
pkg/sql/catalog/descs/collection.go#L885-L887
pkg/sql/catalog/descs/collection.go#L1042-L1044
pkg/sql/catalog/descs/descriptor.go#L201-L203
pkg/sql/catalog/internal/catkv/catalog_reader_cached.go#L356-L358
pkg/sql/catalog/internal/catkv/catalog_reader.go#L355-L357
pkg/sql/catalog/internal/catkv/catalog_query.go#L69-L71
pkg/sql/catalog/internal/catkv/catalog_query.go#L108-L110
pkg/sql/catalog/internal/catkv/catalog_query.go#L175-L177
pkg/sql/catalog/descbuilder/desc_builder.go#L45-L47
pkg/sql/catalog/descbuilder/desc_builder.go#L67-L69
pkg/sql/catalog/tabledesc/table_desc_builder.go#L171-L173
pkg/sql/catalog/tabledesc/table_desc_builder.go#L158-L160
src/runtime/asm_amd64.s#L1694-L1696
pkg/util/stop/stopper.go#L497-L499
pkg/sql/virtual_table.go#L138-L140
pkg/sql/virtual_table.go#L137-L139
pkg/sql/virtual_schema.go#L656-L658
pkg/sql/pg_catalog.go#L1178-L1180
pkg/sql/information_schema.go#L2648-L2650
pkg/sql/catalog/descs/collection.go#L1069-L1071
pkg/sql/catalog/descs/collection.go#L885-L887
pkg/sql/catalog/descs/collection.go#L1042-L1044
pkg/sql/catalog/descs/descriptor.go#L201-L203
pkg/sql/catalog/internal/catkv/catalog_reader_cached.go#L356-L358
pkg/sql/catalog/internal/catkv/catalog_reader.go#L355-L357
pkg/sql/catalog/internal/catkv/catalog_query.go#L69-L71
pkg/sql/catalog/internal/catkv/catalog_query.go#L108-L110
pkg/sql/catalog/internal/catkv/catalog_query.go#L175-L177
pkg/sql/catalog/descbuilder/desc_builder.go#L45-L47
pkg/sql/catalog/descbuilder/desc_builder.go#L67-L69
pkg/sql/catalog/tabledesc/table_desc_builder.go#L169-L171
pkg/sql/catalog/tabledesc/table_desc_builder.go#L516-L518
pkg/sql/catalog/tabledesc/table_desc_builder.go#L1319-L1321

src/runtime/asm_amd64.s in runtime.goexit at line 1695
pkg/util/stop/stopper.go in pkg/util/stop.(*Stopper).RunAsyncTaskEx.func2 at line 498
pkg/sql/virtual_table.go in pkg/sql.setupGenerator.func3 at line 139
pkg/sql/virtual_table.go in pkg/sql.setupGenerator.func3.1 at line 138
pkg/sql/virtual_schema.go in pkg/sql.(*virtualDefEntry).getPlanInfo.func1.1 at line 657
pkg/sql/pg_catalog.go in pkg/sql.makeAllRelationsVirtualTableWithDescriptorIDIndex.func1 at line 1179
pkg/sql/information_schema.go in pkg/sql.forEachTableDesc at line 2649
pkg/sql/catalog/descs/collection.go in pkg/sql/catalog/descs.(*Collection).GetAllDescriptorsForDatabase at line 1070
pkg/sql/catalog/descs/collection.go in pkg/sql/catalog/descs.(*Collection).GetAllInDatabase at line 886
pkg/sql/catalog/descs/collection.go in pkg/sql/catalog/descs.(*Collection).aggregateAllLayers at line 1043
pkg/sql/catalog/descs/descriptor.go in pkg/sql/catalog/descs.getDescriptorsByID at line 202
pkg/sql/catalog/internal/catkv/catalog_reader_cached.go in pkg/sql/catalog/internal/catkv.(*cachedCatalogReader).GetByIDs at line 357
pkg/sql/catalog/internal/catkv/catalog_reader.go in pkg/sql/catalog/internal/catkv.catalogReader.GetByIDs at line 356
pkg/sql/catalog/internal/catkv/catalog_query.go in pkg/sql/catalog/internal/catkv.catalogQuery.query at line 70
pkg/sql/catalog/internal/catkv/catalog_query.go in pkg/sql/catalog/internal/catkv.catalogQuery.processDescriptorResultRow at line 111
pkg/sql/catalog/internal/catkv/catalog_query.go in pkg/sql/catalog/internal/catkv.wrapError at line 168
src/runtime/asm_amd64.s in runtime.goexit at line 1695
pkg/util/stop/stopper.go in pkg/util/stop.(*Stopper).RunAsyncTaskEx.func2 at line 498
pkg/sql/virtual_table.go in pkg/sql.setupGenerator.func3 at line 139
pkg/sql/virtual_table.go in pkg/sql.setupGenerator.func3.1 at line 138
pkg/sql/virtual_schema.go in pkg/sql.(*virtualDefEntry).getPlanInfo.func1.1 at line 657
pkg/sql/pg_catalog.go in pkg/sql.makeAllRelationsVirtualTableWithDescriptorIDIndex.func1 at line 1179
pkg/sql/information_schema.go in pkg/sql.forEachTableDesc at line 2649
pkg/sql/catalog/descs/collection.go in pkg/sql/catalog/descs.(*Collection).GetAllDescriptorsForDatabase at line 1070
pkg/sql/catalog/descs/collection.go in pkg/sql/catalog/descs.(*Collection).GetAllInDatabase at line 886
pkg/sql/catalog/descs/collection.go in pkg/sql/catalog/descs.(*Collection).aggregateAllLayers at line 1043
pkg/sql/catalog/descs/descriptor.go in pkg/sql/catalog/descs.getDescriptorsByID at line 202
pkg/sql/catalog/internal/catkv/catalog_reader_cached.go in pkg/sql/catalog/internal/catkv.(*cachedCatalogReader).GetByIDs at line 357
pkg/sql/catalog/internal/catkv/catalog_reader.go in pkg/sql/catalog/internal/catkv.catalogReader.GetByIDs at line 356
pkg/sql/catalog/internal/catkv/catalog_query.go in pkg/sql/catalog/internal/catkv.catalogQuery.query at line 70
pkg/sql/catalog/internal/catkv/catalog_query.go in pkg/sql/catalog/internal/catkv.catalogQuery.processDescriptorResultRow at line 109
pkg/sql/catalog/internal/catkv/catalog_query.go in pkg/sql/catalog/internal/catkv.build at line 176
pkg/sql/catalog/descbuilder/desc_builder.go in pkg/sql/catalog/descbuilder.FromSerializedValue at line 46
pkg/sql/catalog/descbuilder/desc_builder.go in pkg/sql/catalog/descbuilder.fromProtobufAndMVCCTimestamp at line 68
pkg/sql/catalog/tabledesc/table_desc_builder.go in pkg/sql/catalog/tabledesc.(*tableDescriptorBuilder).RunPostDeserializationChanges at line 172
pkg/sql/catalog/tabledesc/table_desc_builder.go in pkg/sql/catalog/tabledesc.(*tableDescriptorBuilder).RunPostDeserializationChanges.func1 at line 159
src/runtime/asm_amd64.s in runtime.goexit at line 1695
pkg/util/stop/stopper.go in pkg/util/stop.(*Stopper).RunAsyncTaskEx.func2 at line 498
pkg/sql/virtual_table.go in pkg/sql.setupGenerator.func3 at line 139
pkg/sql/virtual_table.go in pkg/sql.setupGenerator.func3.1 at line 138
pkg/sql/virtual_schema.go in pkg/sql.(*virtualDefEntry).getPlanInfo.func1.1 at line 657
pkg/sql/pg_catalog.go in pkg/sql.makeAllRelationsVirtualTableWithDescriptorIDIndex.func1 at line 1179
pkg/sql/information_schema.go in pkg/sql.forEachTableDesc at line 2649
pkg/sql/catalog/descs/collection.go in pkg/sql/catalog/descs.(*Collection).GetAllDescriptorsForDatabase at line 1070
pkg/sql/catalog/descs/collection.go in pkg/sql/catalog/descs.(*Collection).GetAllInDatabase at line 886
pkg/sql/catalog/descs/collection.go in pkg/sql/catalog/descs.(*Collection).aggregateAllLayers at line 1043
pkg/sql/catalog/descs/descriptor.go in pkg/sql/catalog/descs.getDescriptorsByID at line 202
pkg/sql/catalog/internal/catkv/catalog_reader_cached.go in pkg/sql/catalog/internal/catkv.(*cachedCatalogReader).GetByIDs at line 357
pkg/sql/catalog/internal/catkv/catalog_reader.go in pkg/sql/catalog/internal/catkv.catalogReader.GetByIDs at line 356
pkg/sql/catalog/internal/catkv/catalog_query.go in pkg/sql/catalog/internal/catkv.catalogQuery.query at line 70
pkg/sql/catalog/internal/catkv/catalog_query.go in pkg/sql/catalog/internal/catkv.catalogQuery.processDescriptorResultRow at line 109
pkg/sql/catalog/internal/catkv/catalog_query.go in pkg/sql/catalog/internal/catkv.build at line 176
pkg/sql/catalog/descbuilder/desc_builder.go in pkg/sql/catalog/descbuilder.FromSerializedValue at line 46
pkg/sql/catalog/descbuilder/desc_builder.go in pkg/sql/catalog/descbuilder.fromProtobufAndMVCCTimestamp at line 68
pkg/sql/catalog/tabledesc/table_desc_builder.go in pkg/sql/catalog/tabledesc.(*tableDescriptorBuilder).RunPostDeserializationChanges at line 170
pkg/sql/catalog/tabledesc/table_desc_builder.go in pkg/sql/catalog/tabledesc.maybeFillInDescriptor at line 517
pkg/sql/catalog/tabledesc/table_desc_builder.go in pkg/sql/catalog/tabledesc.maybeFixUsesSequencesIDForIdentityColumns at line 1320

Tags

Tag Value
Command server
Environment v24.3.3
Go Version go1.22.8 X:nocoverageredesign
Platform linux amd64
Distribution CCL
Cockroach Release v24.3.3
Cockroach SHA 343b420
# of CPUs 4
# of Goroutines 520

Jira issue: CRDB-46444

@cockroach-sentry cockroach-sentry added branch-release-24.3 Used to mark GA and release blockers, technical advisories, and bugs for 24.3 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. labels Jan 13, 2025
Copy link

blathers-crl bot commented Jan 13, 2025

CC'ing via the CODEOWNERS-based sentry heuristic:

  • @cockroachdb/sql-foundations

🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is dev-inf.

@rafiss
Copy link
Collaborator

rafiss commented Jan 14, 2025

We identified which CC cluster this is coming from. See https://cockroachlabs.slack.com/archives/CJX8V9SJ2/p1736800954157709

The GENERATED column looks weird. It shouldn't have unique_rowid().

{
    "table": {
        "columns": [
            {
                "defaultExpr": "unique_rowid()",
                "generatedAsIdentityType": "GENERATED_ALWAYS",
                "id": 1,
                "name": "id",
                "type": {
                    "family": "IntFamily",
                    "oid": 20,
                    "width": 64
                }
            },
// ....

I'll try to investigate how they landed up in this state.

@exalate-issue-sync exalate-issue-sync bot changed the title Sentry: table_desc_builder.go:1320: referenced descriptor ID 201: table × (201): identity column × (1) on table × must own a sequence (1) Wraps: (2) Wraps: (3) Wraps: (4) Wraps: (5) attached stack ... Sentry: table_desc_builder.go:1320: referenced descriptor ID 201: table × (201): identity column × (1) on table × must own a sequence (1) Wraps: (2) Wraps: (3) Wraps: (4) Wraps: (5) attached stack ... Jan 14, 2025
@rafiss
Copy link
Collaborator

rafiss commented Jan 14, 2025

I've tracked this down further. The following is allowed in 24.2 and earlier, but it shouldn't be:

> SET serial_normalization = rowid; -- this is the default value of the setting.

> create table t (a serial generated always as identity, b int);

In 24.3 we block this, and it fails with:

ERROR: relation "t" (105): column is identity without sequence references "a"

The reason this shouldn't be allowed is because using SERIAL with serial_normalization = rowid means that the column's default value is unique_rowid() rather than being backed by a sequence.

There's a similar Sentry report for a different cluster here: #138925

@rafiss
Copy link
Collaborator

rafiss commented Jan 14, 2025

Discussed more here: https://cockroachlabs.slack.com/archives/C04N0AS14CT/p1736890230158459

I'm repairing this with:

SELECT
                                  crdb_internal.unsafe_upsert_descriptor(
                                      d.id,
                                      crdb_internal.json_to_pb(
                                          'cockroach.sql.sqlbase.Descriptor',
                                          json_set(
                                              crdb_internal.pb_to_json('cockroach.sql.sqlbase.Descriptor', d.descriptor),
                                              ARRAY['table', 'columns', '0', 'generatedAsIdentityType'],
                                              '"NOT_IDENTITY_COLUMN"'::JSONB
                                          )
                                      ),
                                      true
                                  )
                              FROM
                                  system.descriptor AS d INNER JOIN system.namespace AS ns ON d.id = ns.id
                              WHERE
                                  ns.id = 201;

@rafiss
Copy link
Collaborator

rafiss commented Jan 14, 2025

Unfortunately the repair didn't work:

ERROR: internal error: crdb_internal.unsafe_upsert_descriptor(): table "<x>" (201): identity column id (1) on table <x> must own a sequence
SQLSTATE: XX000
DETAIL: stack trace:
pkg/sql/catalog/tabledesc/table_desc_builder.go:1320: maybeFixUsesSequencesIDForIdentityColumns()
pkg/sql/catalog/tabledesc/table_desc_builder.go:517: maybeFillInDescriptor()
pkg/sql/catalog/tabledesc/table_desc_builder.go:170: RunPostDeserializationChanges()
pkg/sql/catalog/descbuilder/desc_builder.go:68: fromProtobufAndMVCCTimestamp()
pkg/sql/catalog/descbuilder/desc_builder.go:46: FromSerializedValue()
pkg/sql/repair.go:713: unsafeReadDescriptor()
pkg/sql/repair.go:82: UnsafeUpsertDescriptor()
pkg/sql/sem/builtins/builtins.go:6598: func672()
pkg/sql/colexec/builtin_funcs.go:72: func1()
pkg/sql/colmem/allocator.go:443: PerformOperation()
pkg/sql/colexec/builtin_funcs.go:49: Next()
pkg/sql/colexec/colexecbase/simple_project.go:119: Next()
pkg/sql/colflow/stats.go:113: next()
pkg/sql/colexecerror/error.go:162: CatchVectorizedRuntimeError()
pkg/sql/colflow/stats.go:121: Next()
pkg/sql/colflow/flow_coordinator.go:241: nextAdapter()
pkg/sql/colexecerror/error.go:162: CatchVectorizedRuntimeError()
pkg/sql/colflow/flow_coordinator.go:245: next()
pkg/sql/colflow/flow_coordinator.go:277: Run()
pkg/sql/colflow/vectorized_flow.go:315: Run()
pkg/sql/distsql_running.go:924: Run()
pkg/sql/distsql_running.go:2017: PlanAndRun()
pkg/sql/distsql_running.go:1731: func3()
pkg/sql/distsql_running.go:1734: PlanAndRunAll()
pkg/sql/conn_executor_exec.go:2440: execWithDistSQLEngine()
pkg/sql/conn_executor_exec.go:1986: dispatchToExecutionEngine()
pkg/sql/conn_executor_exec.go:1192: execStmtInOpenState()
pkg/sql/conn_executor_exec.go:141: func1()
pkg/sql/conn_executor_exec.go:3456: execWithProfiling()
pkg/sql/conn_executor_exec.go:140: execStmt()
pkg/sql/conn_executor.go:2341: func1()
pkg/sql/conn_executor.go:2346: execCmd()

It's because the descriptor can't be read at all, because of the assertion added to maybeFixUsesSequencesIDForIdentityColumns in 4f99f9c

craig bot pushed a commit that referenced this issue Jan 15, 2025
139084: sql: relax validation for IDENTITY columns r=rafiss a=rafiss

The validations added in 4f99f9c were
too strict. This patch makes it so we can continue having IDENTITY
columns that are not backed by a sequence. This can happen if a SERIAL
column is created with IDENTITY, and serial_normalization=rowid.

informs #138925
informs #138972

Release note (bug fix): Fixed a bug where columns created with GENERATED ... BY IDENTITY with the SERIAL type could incorrectly fail internal validations.

Co-authored-by: Rafi Shamim <[email protected]>
@rafiss
Copy link
Collaborator

rafiss commented Jan 15, 2025

After more discussion, we've decided to continue with the 24.2 behavior of allowing this kind of column. Removing the IDENTITY property would be too destructive a change, since one property of those columns is that they cannot be written to. Instead, we will make the validations less strict, so that an IDENTITY column can be backed by unique_rowid() similar to how it was in 24.2. The validation in #135955 was added with the intention of making sure OwnsSequenceIDs matches UsesSequenceIDs, so we will allow IDENTITY columns to have either 1 or 0 elements in both of those slices.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
branch-release-24.3 Used to mark GA and release blockers, technical advisories, and bugs for 24.3 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. T-sql-foundations SQL Foundations Team (formerly SQL Schema + SQL Sessions) X-blathers-triaged blathers was able to find an owner
Projects
None yet
Development

No branches or pull requests

2 participants