Skip to content

Fix expression lifetime problems#11

Open
bradfordboyle wants to merge 2 commits into
klando:masterfrom
bradfordboyle:dev
Open

Fix expression lifetime problems#11
bradfordboyle wants to merge 2 commits into
klando:masterfrom
bradfordboyle:dev

Conversation

@bradfordboyle

Copy link
Copy Markdown
Contributor

No description provided.

@bradfordboyle

Copy link
Copy Markdown
Contributor Author

@df7cb Here are the extension and packaging changes for PostgreSQL 18. A couple of notes:

  • It looks like the changes for PostgreSQL 17 were only pushed to the repo on git.postgresql.org and not to either GitHub or Codeberg so they are showing up as the first commit in this PR.
  • I've split the changes into two separate commits: 1) a commit updates the extension code to address compilation against PostgreSQL 18, and 2) a commit that updates the Debian packaging for. It's easy enough to squash these commits if needed.
  • Because the extension source was changing, building the package failed locally unless I changed the extension version from 1.3.1 to 1.3.2. I saw the conversation on Discord about using semantic versioning for extensions. If you'd prefer, I can change the version to 1.4.

@df7cb

df7cb commented Jan 9, 2026

Copy link
Copy Markdown
Collaborator

We should move the Debian part to salsa. The different upstream and Debian release/package update cycles just don't work together. I created a new repo there: https://salsa.debian.org/postgresql/pgfincore. But before that, we should clean up the mess here.

@klando what's the future of pgfincore? Is it still useful? There are a few WIP branches by you from 2023/2024, could you merge the good ones and make a new version?

@df7cb

df7cb commented Jan 9, 2026

Copy link
Copy Markdown
Collaborator

I pushed the actual patch part as 31f9ae9.

clang is reporting some expression lifetime problems:

make[1]: Verzeichnis „/home/myon/projects/postgresql/pgfincore/pgfincore/build-18“ wird betreten
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Wendif-labels -Wmissing-format-attribute -Wimplicit-fallthrough=3 -Wcast-function-type -Wshadow=compatible-local -Wformat-security -Wmissing-variable-declarations -fno-strict-aliasing -fwrapv -fexcess-precision=standard -Wno-format-truncation -Wno-stringop-truncation -g -g -O2 -Werror=implicit-function-declaration -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -fno-omit-frame-pointer -g -O2 -Werror=implicit-function-declaration -ffile-prefix-map=/home/myon/projects/postgresql/pgfincore/pgfincore=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -fPIC -fvisibility=hidden -I. -I/home/myon/postgresql/pgfincore/pgfincore -I/usr/include/postgresql/18/server -I/usr/include/postgresql/internal -Wdate-time -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE  -I/usr/include/libxml2     -c -o pgfincore.o /home/myon/postgresql/pgfincore/pgfincore/pgfincore.c
/usr/bin/clang-21 -Wno-ignored-attributes -fno-strict-aliasing -fwrapv -fexcess-precision=standard -Wno-unused-command-line-argument -Wno-compound-token-split-by-macro -Wno-format-truncation -O2  -I. -I/home/myon/postgresql/pgfincore/pgfincore -I/usr/include/postgresql/18/server -I/usr/include/postgresql/internal -Wdate-time -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE  -I/usr/include/libxml2    -flto=thin -emit-llvm -c -o pgfincore.bc /home/myon/postgresql/pgfincore/pgfincore/pgfincore.c
/home/myon/postgresql/pgfincore/pgfincore/pgfincore.c:366:24: warning: object backing the pointer 'fctx->relationpath' will be destroyed
      at the end of the full-expression [-Wdangling-assignment]
  366 |                 fctx->relationpath = relpathpg(fctx->rel, forkName);
      |                                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/myon/postgresql/pgfincore/pgfincore/pgfincore.c:154:9: note: expanded from macro 'relpathpg'
  154 |         relpathbackend((rel)->rd_locator, (rel)->rd_backend, (forkname_to_number(text_to_cstring(forkName)))).str
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/postgresql/18/server/common/relpath.h:143:2: note: expanded from macro 'relpathbackend'
  143 |         GetRelationPath((rlocator).dbOid, (rlocator).spcOid, (rlocator).relNumber, \
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  144 |                                         backend, forknum)
      |                                         ~~~~~~~~~~~~~~~~~
/home/myon/postgresql/pgfincore/pgfincore/pgfincore.c:640:17: warning: object backing the pointer 'relationpath' will be destroyed at
      the end of the full-expression [-Wdangling-assignment]
  640 |         relationpath = relpathpg(rel, forkName);
      |                        ^~~~~~~~~~~~~~~~~~~~~~~~
/home/myon/postgresql/pgfincore/pgfincore/pgfincore.c:154:9: note: expanded from macro 'relpathpg'
  154 |         relpathbackend((rel)->rd_locator, (rel)->rd_backend, (forkname_to_number(text_to_cstring(forkName)))).str
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/postgresql/18/server/common/relpath.h:143:2: note: expanded from macro 'relpathbackend'
  143 |         GetRelationPath((rlocator).dbOid, (rlocator).spcOid, (rlocator).relNumber, \
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  144 |                                         backend, forknum)
      |                                         ~~~~~~~~~~~~~~~~~
/home/myon/postgresql/pgfincore/pgfincore/pgfincore.c:949:24: warning: object backing the pointer 'fctx->relationpath' will be destroyed
      at the end of the full-expression [-Wdangling-assignment]
  949 |                 fctx->relationpath = relpathpg(fctx->rel, forkName);
      |                                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/myon/postgresql/pgfincore/pgfincore/pgfincore.c:154:9: note: expanded from macro 'relpathpg'
  154 |         relpathbackend((rel)->rd_locator, (rel)->rd_backend, (forkname_to_number(text_to_cstring(forkName)))).str
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/postgresql/18/server/common/relpath.h:143:2: note: expanded from macro 'relpathbackend'
  143 |         GetRelationPath((rlocator).dbOid, (rlocator).spcOid, (rlocator).relNumber, \
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  144 |                                         backend, forknum)
      |                                         ~~~~~~~~~~~~~~~~~
3 warnings generated.

I'm uploading a new Debian package with this to get the package unstuck there, but I think this should be resolved before a new version is pushed out with this. (Ok, admittedly this also avoiding the "do we update the extension version" question 😅 )

@bradfordboyle bradfordboyle changed the title Update for PostgreSQL 18 Fix expression lifetime problems Jan 16, 2026
@c2main

c2main commented Mar 12, 2026

Copy link
Copy Markdown
Contributor

We should move the Debian part to salsa. The different upstream and Debian release/package update cycles just don't work together. I created a new repo there: https://salsa.debian.org/postgresql/pgfincore. But before that, we should clean up the mess here.

@klando what's the future of pgfincore? Is it still useful? There are a few WIP branches by you from 2023/2024, could you merge the good ones and make a new version?

Value may have decreased over time but it looks like it's still the only tool providing the features it brings.
I was trying to get to a new version with added linux syscalls...

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