pgsql: Add missing EPQ recheck for TID Scan

2025-09-16 Thread David Rowley
Add missing EPQ recheck for TID Scan The EvalPlanQual recheck for TID Scan wasn't rechecking the TID qual still passed after following update chains. This could result in tuples being updated or deleted by plans using TID Scans where the ctid of the new (updated) tuple no longer matches the claus

pgsql: injection_points: Fix incrementation of variable-numbered stats

2025-09-16 Thread Michael Paquier
injection_points: Fix incrementation of variable-numbered stats The pending entry was not used when incrementing its data, directly manipulating the shared memory pointer, without even locking it. This could mean losing statistics under concurrent activity. The flush callback was a no-op. This

Re: pgsql: Move named LWLock tranche requests to shared memory.

2025-09-16 Thread Michael Paquier
On Tue, Sep 16, 2025 at 11:10:34PM -0500, Nathan Bossart wrote: > I was able to simplify the patch. + if (LocalNamedLWLockTrancheRequestArray) + NamedLWLockTrancheRequestArray = LocalNamedLWLockTrancheRequestArray; It's not a common practice in the code to rely on a shmem state that shoul

Re: pgsql: Move named LWLock tranche requests to shared memory.

2025-09-16 Thread Nathan Bossart
On Tue, Sep 16, 2025 at 10:27:34PM -0500, Nathan Bossart wrote: > It looks like the postmaster is trying to access the request array after > re-initializing shared memory, which of course fails. So, we need to keep > the request array in postmaster's local memory, too. Attached is a quick > attem

Re: pgsql: Move named LWLock tranche requests to shared memory.

2025-09-16 Thread Nathan Bossart
On Wed, Sep 17, 2025 at 11:35:56AM +0900, Michael Paquier wrote: > Since this commit has been merged, batta has kept failing. Here is > the first failure: > https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=batta&dt=2025-09-12%2002%3A05%3A01 Thanks for bringing this to my attention. > And

pgsql: jit: Fix type used for Datum values in LLVM IR.

2025-09-16 Thread Thomas Munro
jit: Fix type used for Datum values in LLVM IR. Commit 2a600a93 made Datum 8 bytes wide everywhere. It was no longer appropriate to use TypeSizeT on 32 bit systems, and JIT compilation would fail with various type check errors. Introduce a separate LLVMTypeRef with the name TypeDatum. TypeSizeT

Re: pgsql: Move named LWLock tranche requests to shared memory.

2025-09-16 Thread Michael Paquier
Ni Nathan, On Thu, Sep 11, 2025 at 09:15:12PM +, Nathan Bossart wrote: > Move named LWLock tranche requests to shared memory. > > In EXEC_BACKEND builds, GetNamedLWLockTranche() can segfault when > called outside of the postmaster process, as it might access > NamedLWLockTrancheRequestArray,

pgsql: injection_points: Fix incrementation of variable-numbered stats

2025-09-16 Thread Michael Paquier
injection_points: Fix incrementation of variable-numbered stats The pending entry was not used when incrementing its data, directly manipulating the shared memory pointer, without even locking it. This could mean losing statistics under concurrent activity. The flush callback was a no-op. This

pgsql: Fix shared memory calculation size of PgAioCtl

2025-09-16 Thread Michael Paquier
Fix shared memory calculation size of PgAioCtl The shared memory size was calculated based on an offset of io_handles, which is itself a pointer included in the structure. We tend to overestimate the shared memory size overall, so this was unlikely an issue in practice, but let's be correct and u

pgsql: Add missing EPQ recheck for TID Range Scan

2025-09-16 Thread David Rowley
Add missing EPQ recheck for TID Range Scan The EvalPlanQual recheck for TID Range Scan wasn't rechecking the TID qual still passed after following update chains. This could result in tuples being updated or deleted by plans using TID Range Scans where the ctid of the new (updated) tuple no longer

pgsql: Fix shared memory calculation size of PgAioCtl

2025-09-16 Thread Michael Paquier
Fix shared memory calculation size of PgAioCtl The shared memory size was calculated based on an offset of io_handles, which is itself a pointer included in the structure. We tend to overestimate the shared memory size overall, so this was unlikely an issue in practice, but let's be correct and u

pgsql: Add missing EPQ recheck for TID Range Scan

2025-09-16 Thread David Rowley
Add missing EPQ recheck for TID Range Scan The EvalPlanQual recheck for TID Range Scan wasn't rechecking the TID qual still passed after following update chains. This could result in tuples being updated or deleted by plans using TID Range Scans where the ctid of the new (updated) tuple no longer

pgsql: Add missing EPQ recheck for TID Range Scan

2025-09-16 Thread David Rowley
Add missing EPQ recheck for TID Range Scan The EvalPlanQual recheck for TID Range Scan wasn't rechecking the TID qual still passed after following update chains. This could result in tuples being updated or deleted by plans using TID Range Scans where the ctid of the new (updated) tuple no longer

pgsql: Add missing EPQ recheck for TID Range Scan

2025-09-16 Thread David Rowley
Add missing EPQ recheck for TID Range Scan The EvalPlanQual recheck for TID Range Scan wasn't rechecking the TID qual still passed after following update chains. This could result in tuples being updated or deleted by plans using TID Range Scans where the ctid of the new (updated) tuple no longer

pgsql: Add missing EPQ recheck for TID Range Scan

2025-09-16 Thread David Rowley
Add missing EPQ recheck for TID Range Scan The EvalPlanQual recheck for TID Range Scan wasn't rechecking the TID qual still passed after following update chains. This could result in tuples being updated or deleted by plans using TID Range Scans where the ctid of the new (updated) tuple no longer

pgsql: Add missing EPQ recheck for TID Range Scan

2025-09-16 Thread David Rowley
Add missing EPQ recheck for TID Range Scan The EvalPlanQual recheck for TID Range Scan wasn't rechecking the TID qual still passed after following update chains. This could result in tuples being updated or deleted by plans using TID Range Scans where the ctid of the new (updated) tuple no longer

pgsql: Fix pg_dump COMMENT dependency for separate domain constraints.

2025-09-16 Thread Noah Misch
Fix pg_dump COMMENT dependency for separate domain constraints. The COMMENT should depend on the separately-dumped constraint, not the domain. Sufficient restore parallelism might fail the COMMENT command by issuing it before the constraint exists. Back-patch to v13, like commit 0858f0f96ebb891c

pgsql: Add missing EPQ recheck for TID Scan

2025-09-16 Thread David Rowley
Add missing EPQ recheck for TID Scan The EvalPlanQual recheck for TID Scan wasn't rechecking the TID qual still passed after following update chains. This could result in tuples being updated or deleted by plans using TID Scans where the ctid of the new (updated) tuple no longer matches the claus

pgsql: Add missing EPQ recheck for TID Scan

2025-09-16 Thread David Rowley
Add missing EPQ recheck for TID Scan The EvalPlanQual recheck for TID Scan wasn't rechecking the TID qual still passed after following update chains. This could result in tuples being updated or deleted by plans using TID Scans where the ctid of the new (updated) tuple no longer matches the claus

pgsql: Add missing EPQ recheck for TID Scan

2025-09-16 Thread David Rowley
Add missing EPQ recheck for TID Scan The EvalPlanQual recheck for TID Scan wasn't rechecking the TID qual still passed after following update chains. This could result in tuples being updated or deleted by plans using TID Scans where the ctid of the new (updated) tuple no longer matches the claus

pgsql: Add missing EPQ recheck for TID Scan

2025-09-16 Thread David Rowley
Add missing EPQ recheck for TID Scan The EvalPlanQual recheck for TID Scan wasn't rechecking the TID qual still passed after following update chains. This could result in tuples being updated or deleted by plans using TID Scans where the ctid of the new (updated) tuple no longer matches the claus

pgsql: Add missing EPQ recheck for TID Scan

2025-09-16 Thread David Rowley
Add missing EPQ recheck for TID Scan The EvalPlanQual recheck for TID Scan wasn't rechecking the TID qual still passed after following update chains. This could result in tuples being updated or deleted by plans using TID Scans where the ctid of the new (updated) tuple no longer matches the claus

pgsql: Add regression expected-files for older OpenSSL in FIPS mode.

2025-09-16 Thread Tom Lane
Add regression expected-files for older OpenSSL in FIPS mode. Cover contrib/pgcrypto, per buildfarm. Author: Tom Lane Discussion: https://postgr.es/m/443709.1757876...@sss.pgh.pa.us Backpatch-through: 17 Branch -- REL_18_STABLE Details --- https://git.postgresql.org/pg/commitdiff/ef5ee

pgsql: Revert "Avoid race condition between "GRANT role" and "DROP ROLE

2025-09-16 Thread Tom Lane
Revert "Avoid race condition between "GRANT role" and "DROP ROLE"". This reverts commit 98fc31d6499163a0a781aa6f13582a07f09cd7c6. That change allowed DROP OWNED BY to drop grants of the target role to other roles, arguing that nobody would need those privileges anymore. But that's not so: if you'

pgsql: Fix pg_dump COMMENT dependency for separate domain constraints.

2025-09-16 Thread Noah Misch
Fix pg_dump COMMENT dependency for separate domain constraints. The COMMENT should depend on the separately-dumped constraint, not the domain. Sufficient restore parallelism might fail the COMMENT command by issuing it before the constraint exists. Back-patch to v13, like commit 0858f0f96ebb891c

pgsql: Fix pg_dump COMMENT dependency for separate domain constraints.

2025-09-16 Thread Noah Misch
Fix pg_dump COMMENT dependency for separate domain constraints. The COMMENT should depend on the separately-dumped constraint, not the domain. Sufficient restore parallelism might fail the COMMENT command by issuing it before the constraint exists. Back-patch to v13, like commit 0858f0f96ebb891c

pgsql: Fix pg_dump COMMENT dependency for separate domain constraints.

2025-09-16 Thread Noah Misch
Fix pg_dump COMMENT dependency for separate domain constraints. The COMMENT should depend on the separately-dumped constraint, not the domain. Sufficient restore parallelism might fail the COMMENT command by issuing it before the constraint exists. Back-patch to v13, like commit 0858f0f96ebb891c

pgsql: Fix pg_dump COMMENT dependency for separate domain constraints.

2025-09-16 Thread Noah Misch
Fix pg_dump COMMENT dependency for separate domain constraints. The COMMENT should depend on the separately-dumped constraint, not the domain. Sufficient restore parallelism might fail the COMMENT command by issuing it before the constraint exists. Back-patch to v13, like commit 0858f0f96ebb891c

pgsql: Fix pg_dump COMMENT dependency for separate domain constraints.

2025-09-16 Thread Noah Misch
Fix pg_dump COMMENT dependency for separate domain constraints. The COMMENT should depend on the separately-dumped constraint, not the domain. Sufficient restore parallelism might fail the COMMENT command by issuing it before the constraint exists. Back-patch to v13, like commit 0858f0f96ebb891c

pgsql: Fix pg_dump COMMENT dependency for separate domain constraints.

2025-09-16 Thread Noah Misch
Fix pg_dump COMMENT dependency for separate domain constraints. The COMMENT should depend on the separately-dumped constraint, not the domain. Sufficient restore parallelism might fail the COMMENT command by issuing it before the constraint exists. Back-patch to v13, like commit 0858f0f96ebb891c

pgsql: doc PG 18 relnotes: add mention of temporal foreign key constr.

2025-09-16 Thread Bruce Momjian
doc PG 18 relnotes: add mention of temporal foreign key constr. Reported-by: Yugo Nagata Author: Yugo Nagata Discussion: https://postgr.es/m/20250901200148.baca5744b27419c87c323...@sraoss.co.jp Backpatch-through: 18 only Branch -- REL_18_STABLE Details --- https://git.postgresql.org/

pgsql: Add regression expected-files for older OpenSSL in FIPS mode.

2025-09-16 Thread Tom Lane
Add regression expected-files for older OpenSSL in FIPS mode. In our previous discussions around making our regression tests pass in FIPS mode, we concluded that we didn't need to support the different error message wording observed with pre-3.0 OpenSSL. However there are still a few LTS distribut

pgsql: Add regression expected-files for older OpenSSL in FIPS mode.

2025-09-16 Thread Tom Lane
Add regression expected-files for older OpenSSL in FIPS mode. In our previous discussions around making our regression tests pass in FIPS mode, we concluded that we didn't need to support the different error message wording observed with pre-3.0 OpenSSL. However there are still a few LTS distribut

pgsql: pg_dump: Fix dumping of security labels on subscriptions and eve

2025-09-16 Thread Fujii Masao
pg_dump: Fix dumping of security labels on subscriptions and event triggers. Previously, pg_dump incorrectly queried pg_seclabel to retrieve security labels for subscriptions, which are stored in pg_shseclabel as they are global objects. This could result in security labels for subscriptions not b

pgsql: pg_dump: Fix dumping of security labels on subscriptions and eve

2025-09-16 Thread Fujii Masao
pg_dump: Fix dumping of security labels on subscriptions and event triggers. Previously, pg_dump incorrectly queried pg_seclabel to retrieve security labels for subscriptions, which are stored in pg_shseclabel as they are global objects. This could result in security labels for subscriptions not b

pgsql: Treat JsonConstructorExpr as non-strict

2025-09-16 Thread Richard Guo
Treat JsonConstructorExpr as non-strict JsonConstructorExpr can produce non-NULL output with a NULL input, so it should be treated as a non-strict construct. Failing to do so can lead to incorrect query behavior. For example, in the reported case, when pulling up a subquery that is under an oute

pgsql: Treat JsonConstructorExpr as non-strict

2025-09-16 Thread Richard Guo
Treat JsonConstructorExpr as non-strict JsonConstructorExpr can produce non-NULL output with a NULL input, so it should be treated as a non-strict construct. Failing to do so can lead to incorrect query behavior. For example, in the reported case, when pulling up a subquery that is under an oute

pgsql: Treat JsonConstructorExpr as non-strict

2025-09-16 Thread Richard Guo
Treat JsonConstructorExpr as non-strict JsonConstructorExpr can produce non-NULL output with a NULL input, so it should be treated as a non-strict construct. Failing to do so can lead to incorrect query behavior. For example, in the reported case, when pulling up a subquery that is under an oute

pgsql: Treat JsonConstructorExpr as non-strict

2025-09-16 Thread Richard Guo
Treat JsonConstructorExpr as non-strict JsonConstructorExpr can produce non-NULL output with a NULL input, so it should be treated as a non-strict construct. Failing to do so can lead to incorrect query behavior. For example, in the reported case, when pulling up a subquery that is under an oute

pgsql: Move pg_int64 back to postgres_ext.h

2025-09-16 Thread Peter Eisentraut
Move pg_int64 back to postgres_ext.h Fix for commit 3c86223c998. That commit moved the typedef of pg_int64 from postgres_ext.h to libpq-fe.h, because the only remaining place where it might be used is libpq users, and since the type is obsolete, the intent was to limit its scope. The problem is

pgsql: Move pg_int64 back to postgres_ext.h

2025-09-16 Thread Peter Eisentraut
Move pg_int64 back to postgres_ext.h Fix for commit 3c86223c998. That commit moved the typedef of pg_int64 from postgres_ext.h to libpq-fe.h, because the only remaining place where it might be used is libpq users, and since the type is obsolete, the intent was to limit its scope. The problem is

pgsql: pg_restore: Fix comment handling with --no-policies.

2025-09-16 Thread Fujii Masao
pg_restore: Fix comment handling with --no-policies. Previously, pg_restore did not skip comments on policies even when --no-policies was specified. As a result, it could issue COMMENT commands for policies that were never created, causing those commands to fail. This commit fixes the issue by en

pgsql: pg_dump: Fix dumping of security labels on subscriptions and eve

2025-09-16 Thread Fujii Masao
pg_dump: Fix dumping of security labels on subscriptions and event triggers. Previously, pg_dump incorrectly queried pg_seclabel to retrieve security labels for subscriptions, which are stored in pg_shseclabel as they are global objects. This could result in security labels for subscriptions not b

pgsql: pg_dump: Fix dumping of security labels on subscriptions and eve

2025-09-16 Thread Fujii Masao
pg_dump: Fix dumping of security labels on subscriptions and event triggers. Previously, pg_dump incorrectly queried pg_seclabel to retrieve security labels for subscriptions, which are stored in pg_shseclabel as they are global objects. This could result in security labels for subscriptions not b

pgsql: pg_dump: Fix dumping of security labels on subscriptions and eve

2025-09-16 Thread Fujii Masao
pg_dump: Fix dumping of security labels on subscriptions and event triggers. Previously, pg_dump incorrectly queried pg_seclabel to retrieve security labels for subscriptions, which are stored in pg_shseclabel as they are global objects. This could result in security labels for subscriptions not b

pgsql: pg_dump: Fix dumping of security labels on subscriptions and eve

2025-09-16 Thread Fujii Masao
pg_dump: Fix dumping of security labels on subscriptions and event triggers. Previously, pg_dump incorrectly queried pg_seclabel to retrieve security labels for subscriptions, which are stored in pg_shseclabel as they are global objects. This could result in security labels for subscriptions not b