Skip to content

pg19: build cleanly against PostgreSQL 19beta1#385

Merged
sfc-gh-dachristensen merged 1 commit into
add-pg19-cifrom
pgguru/pg19-code-fixes
Jun 5, 2026
Merged

pg19: build cleanly against PostgreSQL 19beta1#385
sfc-gh-dachristensen merged 1 commit into
add-pg19-cifrom
pgguru/pg19-code-fixes

Conversation

@sfc-gh-dachristensen

Copy link
Copy Markdown
Collaborator

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 #include that 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 .c files now include them explicitly:

Header Why
utils/tuplestore.h was reached via nodes/execnodes.h
access/htup_details.h was reached 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 DatumGetTimestampTz, TimestampTzGetDatum, 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_IGNPG_SIG_IGN (pqsigfunc-typed sentinel) when used with pqsignal().
  • 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 now a plain int with COPY_HEADER_TRUE/FALSE/MATCH constants. Reintroduced the typedef locally so the
    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.

Drive-by

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.

Test plan

Built locally against PG19beta1 cleanly 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; the same include patterns applied here cover the breakages they
exhibited under PG19, but CI is the source of truth.

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
sfc-gh-dachristensen merged commit 2cd00e3 into add-pg19-ci Jun 5, 2026
69 of 87 checks passed
@sfc-gh-dachristensen
sfc-gh-dachristensen deleted the pgguru/pg19-code-fixes branch June 5, 2026 16:08
@sfc-gh-dachristensen
sfc-gh-dachristensen restored the pgguru/pg19-code-fixes branch June 11, 2026 22:55
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant