pg19: build cleanly against PostgreSQL 19beta1#385
Merged
Conversation
sfc-gh-dachristensen
force-pushed
the
pgguru/pg19-code-fixes
branch
from
June 4, 2026 20:56
3be33d5 to
b5d5f13
Compare
PG19 dropped a number of transitive header includes and reshaped a few
APIs. Add explicit includes wherever the build broke and shim the
renamed APIs in pg_extension_base/pg_compat.h.
Header reorg (PG19 dropped these from common transitive paths):
- utils/tuplestore.h (was pulled in via nodes/execnodes.h)
- access/htup_details.h (was pulled in via executor/tuptable.h)
- utils/hsearch.h (HASHCTL/hash_create/hash_search)
- catalog/pg_type_d.h (TEXTOID, INTERVALOID, etc.)
- utils/wait_event.h (WAIT_EVENT_CLIENT_READ)
- utils/timestamp.h (Datum<-->TimestampTz, IntervalPGetDatum)
- storage/lock.h (LockAcquire, LockAcquireResult)
- storage/fd.h (AllocateFile, FreeFile)
API changes wrapped behind #if PG_VERSION_NUM >= 190000:
- LWLockNewTrancheId() now requires a name argument; the separate
LWLockRegisterTranche() helper is gone.
- ShmemInitHash() collapsed init_size/max_size into a single nelems.
- SIG_IGN -> PG_SIG_IGN (pqsigfunc-typed sentinel).
- pg_plan_query() gained a trailing ExplainState* (pass NULL).
- CopyFormatOptions.binary / .csv_mode were replaced by an enum
.format field — wrapped behind CopyOptsIsBinary/CopyOptsIsCsvMode
macros in pg_compat.h so callers keep the older names.
- CopyHeaderChoice enum was removed; header_line is a plain int with
COPY_HEADER_TRUE/FALSE/MATCH constants. Reintroduced the typedef
locally so our exported API signature stays stable.
- numeric_int4_opt_error() renamed to numeric_int4_safe() and switched
from a bool* error flag to an ErrorSaveContext* (soft-error API).
Wrapped via an inline shim that preserves the older bool* signature.
pgduck_server is a frontend program; the unused #include "nodes/nodes.h"
in numutils.h started failing because PG19 changed nodes.h to use Datum
in extern declarations. Removed the vestigial include.
Builds clean against PG19 locally for: pg_extension_base, pg_map,
pg_lake_engine, pg_lake_copy, pg_lake. pg_lake_iceberg/pg_lake_table
were not exercised locally because the avro library was not built;
they're expected to need similar include fixes already applied here.
Signed-off-by: David Christensen <david.christensen@snowflake.com>
sfc-gh-dachristensen
force-pushed
the
pgguru/pg19-code-fixes
branch
from
June 5, 2026 11:59
b5d5f13 to
22053fb
Compare
sfc-gh-okalaci
pushed a commit
that referenced
this pull request
Jun 15, 2026
PG19 dropped a number of transitive header includes and reshaped a few
APIs. Add explicit includes wherever the build broke and shim the
renamed APIs in pg_extension_base/pg_compat.h.
Header reorg (PG19 dropped these from common transitive paths):
- utils/tuplestore.h (was pulled in via nodes/execnodes.h)
- access/htup_details.h (was pulled in via executor/tuptable.h)
- utils/hsearch.h (HASHCTL/hash_create/hash_search)
- catalog/pg_type_d.h (TEXTOID, INTERVALOID, etc.)
- utils/wait_event.h (WAIT_EVENT_CLIENT_READ)
- utils/timestamp.h (Datum<-->TimestampTz, IntervalPGetDatum)
- storage/lock.h (LockAcquire, LockAcquireResult)
- storage/fd.h (AllocateFile, FreeFile)
API changes wrapped behind #if PG_VERSION_NUM >= 190000:
- LWLockNewTrancheId() now requires a name argument; the separate
LWLockRegisterTranche() helper is gone.
- ShmemInitHash() collapsed init_size/max_size into a single nelems.
- SIG_IGN -> PG_SIG_IGN (pqsigfunc-typed sentinel).
- pg_plan_query() gained a trailing ExplainState* (pass NULL).
- CopyFormatOptions.binary / .csv_mode were replaced by an enum
.format field — wrapped behind CopyOptsIsBinary/CopyOptsIsCsvMode
macros in pg_compat.h so callers keep the older names.
- CopyHeaderChoice enum was removed; header_line is a plain int with
COPY_HEADER_TRUE/FALSE/MATCH constants. Reintroduced the typedef
locally so our exported API signature stays stable.
- numeric_int4_opt_error() renamed to numeric_int4_safe() and switched
from a bool* error flag to an ErrorSaveContext* (soft-error API).
Wrapped via an inline shim that preserves the older bool* signature.
pgduck_server is a frontend program; the unused #include "nodes/nodes.h"
in numutils.h started failing because PG19 changed nodes.h to use Datum
in extern declarations. Removed the vestigial include.
Builds clean against PG19 locally for: pg_extension_base, pg_map,
pg_lake_engine, pg_lake_copy, pg_lake. pg_lake_iceberg/pg_lake_table
were not exercised locally because the avro library was not built;
they're expected to need similar include fixes already applied here.
Signed-off-by: David Christensen <david.christensen@snowflake.com>
sfc-gh-okalaci
pushed a commit
that referenced
this pull request
Jun 17, 2026
PG19 dropped a number of transitive header includes and reshaped a few
APIs. Add explicit includes wherever the build broke and shim the
renamed APIs in pg_extension_base/pg_compat.h.
Header reorg (PG19 dropped these from common transitive paths):
- utils/tuplestore.h (was pulled in via nodes/execnodes.h)
- access/htup_details.h (was pulled in via executor/tuptable.h)
- utils/hsearch.h (HASHCTL/hash_create/hash_search)
- catalog/pg_type_d.h (TEXTOID, INTERVALOID, etc.)
- utils/wait_event.h (WAIT_EVENT_CLIENT_READ)
- utils/timestamp.h (Datum<-->TimestampTz, IntervalPGetDatum)
- storage/lock.h (LockAcquire, LockAcquireResult)
- storage/fd.h (AllocateFile, FreeFile)
API changes wrapped behind #if PG_VERSION_NUM >= 190000:
- LWLockNewTrancheId() now requires a name argument; the separate
LWLockRegisterTranche() helper is gone.
- ShmemInitHash() collapsed init_size/max_size into a single nelems.
- SIG_IGN -> PG_SIG_IGN (pqsigfunc-typed sentinel).
- pg_plan_query() gained a trailing ExplainState* (pass NULL).
- CopyFormatOptions.binary / .csv_mode were replaced by an enum
.format field — wrapped behind CopyOptsIsBinary/CopyOptsIsCsvMode
macros in pg_compat.h so callers keep the older names.
- CopyHeaderChoice enum was removed; header_line is a plain int with
COPY_HEADER_TRUE/FALSE/MATCH constants. Reintroduced the typedef
locally so our exported API signature stays stable.
- numeric_int4_opt_error() renamed to numeric_int4_safe() and switched
from a bool* error flag to an ErrorSaveContext* (soft-error API).
Wrapped via an inline shim that preserves the older bool* signature.
pgduck_server is a frontend program; the unused #include "nodes/nodes.h"
in numutils.h started failing because PG19 changed nodes.h to use Datum
in extern declarations. Removed the vestigial include.
Builds clean against PG19 locally for: pg_extension_base, pg_map,
pg_lake_engine, pg_lake_copy, pg_lake. pg_lake_iceberg/pg_lake_table
were not exercised locally because the avro library was not built;
they're expected to need similar include fixes already applied here.
Signed-off-by: David Christensen <david.christensen@snowflake.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Builds on top of #363 (add-pg19-ci) — that PR adds the PG19 build/test infrastructure with continue-on-error; this PR makes the code actually compile against PG19.
PG19 dropped a number of transitive header includes and reshaped a few APIs. Most of the diff is just adding the explicit
#includethat PG18 was getting transitively.The handful of real API changes are version-gated behind
#if PG_VERSION_NUM >= 190000.Header reorg
PG19 dropped these from common transitive include paths, so the relevant
.cfiles now include them explicitly:utils/tuplestore.hnodes/execnodes.haccess/htup_details.hexecutor/tuptable.hutils/hsearch.hHASHCTL,hash_create,hash_searchcatalog/pg_type_d.hTEXTOID,INTERVALOID, etc.utils/wait_event.hWAIT_EVENT_CLIENT_READutils/timestamp.hDatumGetTimestampTz,TimestampTzGetDatum,IntervalPGetDatumstorage/lock.hLockAcquire,LockAcquireResultstorage/fd.hAllocateFile,FreeFileAPI changes
Wrapped behind
#if PG_VERSION_NUM >= 190000:LWLockNewTrancheId()now requires a name argument; the separateLWLockRegisterTranche()helper is gone.ShmemInitHash()collapsedinit_size/max_sizeinto a singlenelems.SIG_IGN→PG_SIG_IGN(pqsigfunc-typed sentinel) when used withpqsignal().pg_plan_query()gained a trailingExplainState *(passNULL).CopyFormatOptions.binary/.csv_modewere replaced by an enum.formatfield. Wrapped behindCopyOptsIsBinary/CopyOptsIsCsvModemacros inpg_compat.hso callers keep the older names.
CopyHeaderChoiceenum was removed;header_lineis now a plainintwithCOPY_HEADER_TRUE/FALSE/MATCHconstants. Reintroduced the typedef locally so theexported API signature stays stable.
numeric_int4_opt_error()renamed tonumeric_int4_safe()and switched from abool *error flag to anErrorSaveContext *(soft-error API). Wrapped viaan inline shim that preserves the older
bool *signature.Drive-by
pgduck_serveris a frontend program; the unused#include "nodes/nodes.h"innumutils.hstarted failing because PG19 changednodes.hto useDatumin externdeclarations. Removed the vestigial include.
Test plan
Built locally against PG19beta1 cleanly for:
pg_extension_basepg_mappg_lake_enginepg_lake_copypg_lakepg_lake_iceberg/pg_lake_tablewere not exercised locally because the avro library was not built; the same include patterns applied here cover the breakages theyexhibited under PG19, but CI is the source of truth.
continue-on-erroroverrides and confirm the matrix is green.