system-table-change
System Table Schema Change Checklist
When adding, removing, or modifying columns or indexes on a system table, multiple files and golden test artifacts must be updated in lockstep. Missing any of these causes test failures that can be confusing to debug.
1. Schema Definition
Update the table's schema string and descriptor literal in:
pkg/sql/catalog/systemschema/system.go- The
CREATE TABLEschema string (e.g.,StatementDiagnosticsRequestsTableSchema) - The descriptor literal (e.g.,
StatementDiagnosticsRequestsTable): columns, column IDs, family column names/IDs, index store column names/IDs,NextColumnID NextColumnIDmust be max(column IDs) + 1- When adding/removing columns, update both
ColumnNamesandColumnIDsin the family descriptor - If the column should be stored in a secondary index, update both the schema string's
STORINGclause and the descriptor literal'sStoreColumnNames/StoreColumnIDs
- The
2. New Table Registration (skip if modifying existing table)
If creating a brand new system table, register it in these additional files:
More from cockroachdb/cockroach
commit-helper
Help create git commits and PRs with properly formatted messages and release notes following CockroachDB conventions. Use when committing changes or creating pull requests.
501backport-pr-assistant
Help backport PRs to release branches using the backport CLI tool. Use when backporting changes that have merge conflicts requiring manual resolution.
75reduce-unoptimized-query-oracle
Reduce an unoptimized-query-oracle test failure log to the simplest possible reproduction case. Use when you have unoptimized-query-oracle*.log files from a failed roachtest and need to find the minimal SQL to reproduce the bug.
63engflow-artifacts
Use when downloading test logs, artifacts, or outputs.zip from EngFlow build invocations. Use when investigating CockroachDB CI test failures hosted on mesolite.cluster.engflow.com.
29table-driven-test
Guidelines for creating clean, well-structured table-driven tests in Go following CockroachDB conventions.
26integration-test
Guidelines for writing integration tests with CockroachDB test servers, including when to use them and how to use sqlutils.
18