@@ -3259,22 +3259,34 @@ story_register_idempotent() {
32593259}
32603260
32613261# ───────────────────────────────────────────────────────────────────────────
3262- # Story — TC-113: UNLOGGED partitioned table rejected at register.
3263- # UNLOGGED data is not WAL-logged and is lost on crash — incompatible with
3264- # ColdFront's durability guarantees. Register is where this is caught, so there
3265- # is nothing left to test at archive time: the table never reaches the registry.
3262+ # Story — TC-113: an UNLOGGED relation in the partition tree is rejected at
3263+ # register. UNLOGGED data is truncated after a crash and replicates nowhere, so
3264+ # tiering it would archive rows PostgreSQL never promised to keep.
3265+ #
3266+ # The fixture is a PERMANENT parent with an UNLOGGED partition, which is the case
3267+ # that actually loses rows and is creatable on every supported major. An unlogged
3268+ # PARENT is not usable as a fixture: PG18 refuses it outright ("partitioned tables
3269+ # cannot be unlogged"), so a test built on one asserts PostgreSQL's DDL rules on
3270+ # 16/17 and nothing at all on 18.
32663271# ───────────────────────────────────────────────────────────────────────────
32673272story_unlogged_rejected () {
3268- step " TC-113: UNLOGGED partitioned table rejected at register"
3269- q " $HOST " " CREATE UNLOGGED TABLE IF NOT EXISTS public.tc113_unlogged (
3270- id bigint GENERATED ALWAYS AS IDENTITY, ts timestamptz NOT NULL, PRIMARY KEY (id,ts)
3271- ) PARTITION BY RANGE (ts);" > /dev/null 2>&1 || true
3273+ step " TC-113: UNLOGGED partition rejected at register"
3274+ qf " $HOST " << 'EOSQL ' >/dev/null 2>&1
3275+ CREATE TABLE IF NOT EXISTS public.tc113_unlogged (
3276+ id bigint GENERATED ALWAYS AS IDENTITY, ts timestamptz NOT NULL, PRIMARY KEY (id, ts)
3277+ ) PARTITION BY RANGE (ts);
3278+ CREATE UNLOGGED TABLE IF NOT EXISTS public.tc113_unlogged_p
3279+ PARTITION OF public.tc113_unlogged FOR VALUES FROM ('2020-01-01') TO ('2020-02-01');
3280+ EOSQL
3281+ assert_eq " TC-113: fixture has a permanent parent and an unlogged partition" " p|u" \
3282+ " $( q " $HOST " " SELECT string_agg(relpersistence,'|' ORDER BY relname) FROM pg_class WHERE relname IN ('tc113_unlogged','tc113_unlogged_p');" ) "
32723283 if " $ARCHIVER " register --config /tmp/journey-archiver.yaml --table tc113_unlogged \
32733284 --period monthly --hot-period " 30 days" > /tmp/journey-unlogged.log 2>&1 ; then
3274- fail " TC-113: register accepted an UNLOGGED table "
3285+ fail " TC-113: register accepted a tree containing an unlogged partition "
32753286 else
3276- assert_contains " TC-113: register rejected UNLOGGED with a clear error" " unlogged" \
3277- " $( tr ' [:upper:]' ' [:lower:]' < /tmp/journey-unlogged.log) "
3287+ # Names the offending partition, not just the parent the caller typed.
3288+ assert_contains " TC-113: register named the unlogged partition" " tc113_unlogged_p" \
3289+ " $( cat /tmp/journey-unlogged.log) "
32783290 fi
32793291 assert_eq " TC-113: nothing registered" " 0" \
32803292 " $( q " $HOST " " SELECT count(*) FROM coldfront.partition_config WHERE table_name='tc113_unlogged';" ) "
0 commit comments