Skip to content

Fix build against PostgreSQL 19 - #27

Open
devrimgunduz wants to merge 1 commit into
bigsql:masterfrom
devrimgunduz:master
Open

Fix build against PostgreSQL 19#27
devrimgunduz wants to merge 1 commit into
bigsql:masterfrom
devrimgunduz:master

Conversation

@devrimgunduz

Copy link
Copy Markdown

plprofiler.h:

  • PG19's header include-what-you-use (IWYU) cleanup means <storage/lwlock.h>, <storage/shmem.h> and <utils/tuplestore.h> are no longer pulled in transitively by the headers plprofiler.h already included. Without them, LWLockAcquire/LWLockRelease, RequestAddinShmemSpace/RequestNamedLWLockTranche, ShmemInitStruct/ ShmemInitHash/GetNamedLWLockTranche and tuplestore_begin_heap/ tuplestore_putvalues were all implicitly declared, producing the "call to undeclared function" / "incompatible integer to pointer conversion" errors seen on both clang (LLVM bitcode build) and gcc. Add the three missing includes to plprofiler.h.
  • profilerSharedState.lock was declared as "LWLockId", a typedef that was removed from PostgreSQL back in 9.4 when LWLocks moved to a pointer-based API. The plprofiler code itself already treats plpss->lock as a pointer (e.g. "plpss->lock = &(GetNamedLWLockTranche(...))->lock;"), so the struct member had been silently relying on an implicit int-to- pointer conversion that recent compilers (and C99+) no longer allow. Change the member to the correct "LWLock *" type.

plprofiler.c:

  • PG19 changed the signature of ShmemInitHash() from HTAB *ShmemInitHash(const char *name, long init_size, long max_size, HASHCTL *infoP, int hash_flags); to HTAB *ShmemInitHash(const char *name, int64 nelems, HASHCTL *infoP, int hash_flags); collapsing the separate init_size/max_size arguments into a single nelems argument. Both call sites in profiler_shmem_startup() (for the "plprofiler functions" and "plprofiler callgraph" shared hash tables) were passing the old 5-argument form, which now fails to compile ("too many arguments to function call" / argument-type mismatches). Drop the redundant init_size argument at both call sites so only one size argument (nelems) is passed.

Hacked by Claude, tested by me.

Per pgdg-packaging/pgdg-rpms#213

  plprofiler.h:
  * PG19's header include-what-you-use (IWYU) cleanup means
    <storage/lwlock.h>, <storage/shmem.h> and <utils/tuplestore.h>
    are no longer pulled in transitively by the headers plprofiler.h
    already included. Without them, LWLockAcquire/LWLockRelease,
    RequestAddinShmemSpace/RequestNamedLWLockTranche, ShmemInitStruct/
    ShmemInitHash/GetNamedLWLockTranche and tuplestore_begin_heap/
    tuplestore_putvalues were all implicitly declared, producing the
    "call to undeclared function" / "incompatible integer to pointer
    conversion" errors seen on both clang (LLVM bitcode build) and
    gcc. Add the three missing includes to plprofiler.h.
  * profilerSharedState.lock was declared as "LWLockId", a typedef
    that was removed from PostgreSQL back in 9.4 when LWLocks moved
    to a pointer-based API. The plprofiler code itself already treats
    plpss->lock as a pointer (e.g.
    "plpss->lock = &(GetNamedLWLockTranche(...))->lock;"), so the
    struct member had been silently relying on an implicit int-to-
    pointer conversion that recent compilers (and C99+) no longer
    allow. Change the member to the correct "LWLock *" type.

  plprofiler.c:
  * PG19 changed the signature of ShmemInitHash() from
      HTAB *ShmemInitHash(const char *name, long init_size,
                           long max_size, HASHCTL *infoP,
                           int hash_flags);
    to
      HTAB *ShmemInitHash(const char *name, int64 nelems,
                           HASHCTL *infoP, int hash_flags);
    collapsing the separate init_size/max_size arguments into a
    single nelems argument. Both call sites in profiler_shmem_startup()
    (for the "plprofiler functions" and "plprofiler callgraph" shared
    hash tables) were passing the old 5-argument form, which now fails
    to compile ("too many arguments to function call" / argument-type
    mismatches). Drop the redundant init_size argument at both call
    sites so only one size argument (nelems) is passed.

Hacked by Claude, tested by me.
@luss

luss commented Jul 10, 2026 via email

Copy link
Copy Markdown
Contributor

@adeshthack

Copy link
Copy Markdown

is there any update on pg19 compatibility?

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.

3 participants