Skip to content

PG19: fix runtime crashes outside the regression suite #8610

Description

Part of the PG19 support umbrella: #8597.

After the build foundation (#8601) the extension loads, but three PG19
changes crash backends in ordinary use (no regression harness
involved).

1. FuncnameGetCandidates writes to its new out-parameter

PG19 added an int *fgc_flags out-parameter. #8601 stubbed it by passing
NULL; PG19's catalog lookup dereferences that pointer, so any Citus
call that resolves a function by name crashes the backend. Fix: pass the
address of a compound-literal int instead of NULL.

2. TupleDesc.firstNonCachedOffsetAttr no longer populated by BlessTupleDesc()

PG19's per-TupleDesc offset cache is asserted-populated but no longer
filled in by BlessTupleDesc(). Citus builds many TupleDescs by hand
(intermediate-result tuplestores, EXPLAIN ANALYZE destinations, the
pg_stat_statements SRF descriptor). Add explicit TupleDescFinalize()
calls at those sites plus a pg_version_compat.h shim (wrap
BlessTupleDesc() on PG19; no-op TupleDescFinalize() on PG <= 18).

3. config_generic layout changed

PG19 turned the type-specific suffix into an embedded union. Citus' GUC
override in OverridePostgresConfigProperties() cast config_generic *
straight to config_string *, which now reads garbage and crashes when
the application_name assign hook fires. Access config_string via
var->_string on PG19, guarded by #if PG_VERSION_NUM >= PG_VERSION_19.

Validation

PG17.10 / PG18.4 / PG19devel build green under -Werror; PG17/PG18
regression-neutral. multi_cluster_management is the canonical PG19
reproducer for the TupleDesc bug.

Plan detail: pg19-pr-plan/02-runtime-non-regress.md (PR2).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions