cockroachdb / cockroachdb/cockroach

sql: value set in DEFAULT clause of ADD COLUMN to be stored as metadata

Open
#98,415 4 comments 0 reactions 0 assignees View on GitHub
C-enhancement T-sql-foundations
Dominant language
Go
Stars
32.5k
Forks
4.1k
PR merge metrics
PR metrics pending

Description

Currently, if you specify the DEFAULT clause for a column, the table is [back]filled with the given default value.

We could optimize the behavior and provide the option so that the default value is stored as metadata but the column itself is not populated.

[slack](https://cockroachlabs.slack.com/archives/CHVV403F0/p1678482973406139)

Jira issue: CRDB-25253

gz#16284

Epic CRDB-61003

Contributor guide

Open the contributing guide

Research direction

Start by tracing the ADD COLUMN path for a DEFAULT clause and the existing backfill behavior. Define the option and verify that the default is retained as metadata while existing rows remain unpopulated, then cover the behavior in the relevant SQL tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, sql
Domain
databases
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.