citusdata / citusdata/citus

PG19: report explicit unsupported errors for partition merge/split and ALTER CONSTRAINT

Open
#8,758 1 comment 0 reactions 0 assignees View on GitHub
pg19_features
Dominant language
C
Stars
12.8k
Forks
794
Avg merge
2d 14h
Merged PRs (30d)
31

Description

## Problem

Citus safely rejects these ALTER TABLE subcommands on distributed and Citus-local tables through the generic unsupported-command fallback:

- PostgreSQL 19 `MERGE PARTITIONS`
- PostgreSQL 19 `SPLIT PARTITION`
- `ALTER CONSTRAINT`, including PG19 CHECK constraint enforceability

The rejection is safe and occurs before DDL jobs or shard changes, but the generic allowlist detail does not identify the unsupported operation or explain that it is not propagated to shards.

## Verified behavior

- Ordinary PostgreSQL tables bypass Citus and PostgreSQL executes the commands.
- Distributed and Citus-local tables fail closed before propagation.
- Reference tables reject applicable `ALTER CONSTRAINT` forms similarly.
- Coordinator and shard partition/constraint state remains unchanged under normal Citus processing.
- `citus.enable_ddl_propagation=off` is only a manual escape hatch and can intentionally create coordinator/shard divergence; it is not support for these operations.

## Scope decision

Do **not** implement distributed MERGE/SPLIT semantics in this issue. PostgreSQL core performs relation creation/deletion, row movement, constraint/index/trigger/dependency cloning, and access-exclusive locking. Correct Citus support additionally requires shard mapping/localization, placements, colocation, metadata, MX, and atomic lifecycle design.

## Proposed minimum change

- Add PG19-gated subtype-specific `FEATURE_NOT_SUPPORTED` cases for `AT_MergePartitions` and `AT_SplitPartition`.
- Add an explicit `AT_AlterConstraint` rejection across supported versions.
- Use command-specific messages/details stating the operation is not propagated to shards; do not extend the already-stale generic allowlist detail.

## Acceptance criteria

- PG19 local-table success remains unchanged.
- Distributed/Citus-local MERGE and SPLIT return explicit stable errors and preserve partition state.
- Local CHECK `ALTER CONSTRAINT ... [NOT] ENFORCED` succeeds; distributed/Citus-local/reference forms return explicit errors and preserve `conenforced` on coordinator/shards.
- Existing PG18 FK ENFORCED and older FK DEFERRABLE rejection expectations are updated consistently.
- `pg19_0.out` and unaffected versions remain stable.

Contributor guide

Open the contributing guide

Research direction

Start by locating the handling of AT_MergePartitions, AT_SplitPartition, and AT_AlterConstraint, along with the tests and expected output for these ALTER TABLE cases. Check how existing unsupported-command errors are reported and how PostgreSQL-version-specific expectations are organized. Done means the specified explicit errors are covered, local PostgreSQL behavior remains unchanged, partition and constraint state is preserved, and pg19_0.out plus unaffected versions remain stable.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, postgresql
Domain
databases, distributed-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.