cockroachdb / cockroachdb/cockroach
sql/schemachanger: default stored-procedure-body DDL to the declarative schema changer
- Dominant language
- Go
- Stars
- 32.5k
- Forks
- 4.1k
- PR merge metrics
- PR metrics pending
Description
**Is your feature request related to a problem?**
[#172677](https://github.com/cockroachdb/cockroach/issues/172677) added the ability to run DDL statements inside stored procedure bodies through the declarative schema changer (DSC) instead of the legacy schema changer. However, that path is gated behind an off-by-default cluster setting while the feature matures — so by default, DDL inside a stored procedure still routes to the legacy schema changer.
Once the DSC path is proven out, we want the DSC to be the default schema changer chosen for DDL executed inside a stored procedure body, rather than the legacy schema changer.
**Describe the solution you'd like:**
Flip the default so that DDL executed within a stored procedure body runs through the declarative schema changer by default (i.e., enable the setting introduced in #172677 by default). This lets procedure-body DDL compose transactionally with the rest of the `CALL` — DDL and DML in the body commit or roll back atomically through the declarative path — without requiring an operator to opt in.
Scope note: this default change applies **only** to DDL executed within a stored procedure. It does not change the default schema changer for general/top-level DDL.
**Describe alternatives you've considered:**
- **Leave the setting off by default:** requires every cluster to opt in to get transactional procedure-body DDL, which limits adoption and leaves the legacy path as the default indefinitely.
- **Wait for general multi-statement declarative transactional DDL before flipping any default:** unnecessary; the constrained procedure-body DDL surface is a good first place to make the DSC the default independently.
**Additional context:**
- Enabling work: [#172677](https://github.com/cockroachdb/cockroach/issues/172677) (run stored-procedure-body DDL through the declarative schema changer).
- Related single-schema-changer-per-transaction enforcement: [#172632](https://github.com/cockroachdb/cockroach/issues/172632).
- `CREATE TABLE` support in the DSC ([#98316](https://github.com/cockroachdb/cockroach/issues/98316)) determines how much of the procedure-body DDL surface can run declaratively rather than falling back; its completeness should be considered before flipping the default.
Jira issue: CRDB-66344
Epic CRDB-65937
Contributor guide
Research direction
Start by reading the setting and stored-procedure-body DDL path introduced in #172677, then review the single-schema-changer-per-transaction enforcement in #172632. Check the completeness of CREATE TABLE support from #98316 before changing the default. Done means only procedure-body DDL defaults to the declarative schema changer while top-level DDL remains unchanged.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go, sql
- Domain
- databases
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100