Regression test fails when 1) old PG is installed and 2) meson/ninja build is used - Mailing list pgsql-hackers

From Hayato Kuroda (Fujitsu)
Subject Regression test fails when 1) old PG is installed and 2) meson/ninja build is used
Date
Msg-id OSCPR01MB14966D8A33387F4561F0FB9CAF5B62@OSCPR01MB14966.jpnprd01.prod.outlook.com
Whole thread Raw
Responses Re: Regression test fails when 1) old PG is installed and 2) meson/ninja build is used
List pgsql-hackers
Dear hackers,

While creating patches for older branches I found the $SUBJECT. I do not have much knowledge
for meson thus I'm not sure it is intentional.

Reproducer
=======
I could reproduce the failure with steps:

1. install old PG, e.g., PG16. To your system. .so file must be put on your $$LD_LIBRARY_PATH.
2. build newer PG, e.g., master, with meson build system [1].
3. run regression test and ERROR would be reported [2].

This issue does not happen when I used autoconf/make build system.

Analysis
=====

According to the log, the instance could be started but psql could not work correctly:

```
----------------------------------- stdout -----------------------------------
# executing test in /home/hayato/builddir/testrun/regress/regress group regress test regress
# initializing database system by copying initdb template
# using temp instance on port 40047 with PID 949892
Bail out!# test failed
----------------------------------- stderr -----------------------------------
psql: symbol lookup error: psql: undefined symbol: PQservice
# command failed: "psql" -X -q -c "CREATE DATABASE \"regression\" ...

(test program exited with status code 2)
==============================================================================
```

It looks like that psql required the function `PQservice` in the library but it
could not find in the used libpq.so. Since the function has been introduced since
PG18, I suspect psql tried to link with .so file for old PG (installed one).
IIUC each commands should refer libraries exist in tmp_install, not the system's one.

Is this an issue to be solved on PG community, or specification of meson/ninja?
Or... could it happen only on my environment?

Note
====
I'm using AlmaLinux 9.5. I can give more detail if needed.

[1]:
```
$ meson setup -Dinjection_points=true -Dcassert=true --optimization=0 --debug ../postgres/
The Meson build system
Version: 0.63.3
...
Project name: postgresql
Project version: 18devel
...
$ ninja
...
```

[2]:
```
$ meson test --suite setup --suite regress
ninja: Entering directory `/home/hayato/builddir'
ninja: no work to do.
1/4 postgresql:setup / tmp_install               OK                0.82s
2/4 postgresql:setup / install_test_files        OK                0.05s
3/4 postgresql:setup / initdb_cache              OK                1.88s
4/4 postgresql:regress / regress/regress         ERROR             3.66s   exit status 2
...
Ok:                 3
Expected Fail:      0
Fail:               1
Unexpected Pass:    0
Skipped:            0
Timeout:            0
```

Best regards,
Hayato Kuroda
FUJITSU LIMITED




pgsql-hackers by date:

Previous
From: jian he
Date:
Subject: disallow ALTER VIEW SET DEFAULT when the corresponding base relation column is a generated column
Next
From: Nazir Bilal Yavuz
Date:
Subject: Re: Add pg_buffercache_evict_all() and pg_buffercache_mark_dirty[_all]() functions