pgsql: Add src/include/catalog/README

2025-08-18 Thread Peter Eisentraut
Add src/include/catalog/README This just includes a link to the bki documentation, to help people get started. Before commit 372728b0d49, there was a README at src/backend/catalog/README, but then this was moved to the SGML documentation. So this effectively puts back a link to what was moved.

pgsql: Fix self-deadlock during DROP SUBSCRIPTION.

2025-08-18 Thread Amit Kapila
Fix self-deadlock during DROP SUBSCRIPTION. The DROP SUBSCRIPTION command performs several operations: it stops the subscription workers, removes subscription-related entries from system catalogs, and deletes the replication slot on the publisher server. Previously, this command acquired an Access

pgsql: Fix self-deadlock during DROP SUBSCRIPTION.

2025-08-18 Thread Amit Kapila
Fix self-deadlock during DROP SUBSCRIPTION. The DROP SUBSCRIPTION command performs several operations: it stops the subscription workers, removes subscription-related entries from system catalogs, and deletes the replication slot on the publisher server. Previously, this command acquired an Access

pgsql: Fix self-deadlock during DROP SUBSCRIPTION.

2025-08-18 Thread Amit Kapila
Fix self-deadlock during DROP SUBSCRIPTION. The DROP SUBSCRIPTION command performs several operations: it stops the subscription workers, removes subscription-related entries from system catalogs, and deletes the replication slot on the publisher server. Previously, this command acquired an Access

pgsql: Fix self-deadlock during DROP SUBSCRIPTION.

2025-08-18 Thread Amit Kapila
Fix self-deadlock during DROP SUBSCRIPTION. The DROP SUBSCRIPTION command performs several operations: it stops the subscription workers, removes subscription-related entries from system catalogs, and deletes the replication slot on the publisher server. Previously, this command acquired an Access

pgsql: Fix self-deadlock during DROP SUBSCRIPTION.

2025-08-18 Thread Amit Kapila
Fix self-deadlock during DROP SUBSCRIPTION. The DROP SUBSCRIPTION command performs several operations: it stops the subscription workers, removes subscription-related entries from system catalogs, and deletes the replication slot on the publisher server. Previously, this command acquired an Access

pgsql: Fix self-deadlock during DROP SUBSCRIPTION.

2025-08-18 Thread Amit Kapila
Fix self-deadlock during DROP SUBSCRIPTION. The DROP SUBSCRIPTION command performs several operations: it stops the subscription workers, removes subscription-related entries from system catalogs, and deletes the replication slot on the publisher server. Previously, this command acquired an Access

pgsql: Fix self-deadlock during DROP SUBSCRIPTION.

2025-08-18 Thread Amit Kapila
Fix self-deadlock during DROP SUBSCRIPTION. The DROP SUBSCRIPTION command performs several operations: it stops the subscription workers, removes subscription-related entries from system catalogs, and deletes the replication slot on the publisher server. Previously, this command acquired an Access

pgsql: Refactor ReadMultiXactCounts() into GetMultiXactInfo()

2025-08-18 Thread Michael Paquier
Refactor ReadMultiXactCounts() into GetMultiXactInfo() This provides a single entry point to access some information about the state of MultiXacts, able to return some data about multixacts offsets and counts. Originally this function was only able to return some information about the number of m

pgsql: Remove useless pointer update in StatsShmemInit()

2025-08-18 Thread Michael Paquier
Remove useless pointer update in StatsShmemInit() This pointer was not used after its last update. This variable assignment was most likely a vestige artifact of the earlier versions of the patch set that have led to 5891c7a8ed8f. This pointer update is useless, so let's remove it. It removes o

pgsql: Pathify RHS unique-ification for semijoin planning

2025-08-18 Thread Richard Guo
Pathify RHS unique-ification for semijoin planning There are two implementation techniques for semijoins: one uses the JOIN_SEMI jointype, where the executor emits at most one matching row per left-hand side (LHS) row; the other unique-ifies the right-hand side (RHS) and then performs a plain inne

pgsql: Simplify relation_has_unique_index_for()

2025-08-18 Thread Richard Guo
Simplify relation_has_unique_index_for() Now that the only call to relation_has_unique_index_for() that supplied an exprlist and oprlist has been removed, the loop handling those lists is effectively dead code. This patch removes that loop and simplifies the function accordingly. Author: Richard

pgsql: test_ddl_deparse: Rename test create_sequence_1 to create_sequen

2025-08-18 Thread Michael Paquier
test_ddl_deparse: Rename test create_sequence_1 to create_sequence This test was the only one named following the convention used for alternate output files. This was a little bit confusing when looking at the diffs of the test, because one would think that the diffs are based on an uncommon case

pgsql: Remove unneeded header declarations in multixact.c

2025-08-18 Thread Michael Paquier
Remove unneeded header declarations in multixact.c Two header declarations were related to SQL-callable functions, that should have been cleaned up in df9133fa6384. Some more includes can be removed on closer inspection, so let's clean up these as well, while on it. Reported-by: Tom Lane Discus

Re: pgsql: Move SQL-callable code related to multixacts into its own file

2025-08-18 Thread Tom Lane
Michael Paquier writes: > On Mon, Aug 18, 2025 at 09:47:14AM -0400, Tom Lane wrote: >> Couldn't this have removed some #include-s from multixact.c? > Right. funcapi.h and fmgrprotos.h are direct dependencies, but > looking closer it is also possible to remove four more of them. Sounds good!

Re: pgsql: Move SQL-callable code related to multixacts into its own file

2025-08-18 Thread Michael Paquier
On Mon, Aug 18, 2025 at 09:47:14AM -0400, Tom Lane wrote: > Michael Paquier writes: > > Move SQL-callable code related to multixacts into its own file > > Couldn't this have removed some #include-s from multixact.c? Right. funcapi.h and fmgrprotos.h are direct dependencies, but looking closer i

pgsql: Remove HASH_DEBUG output from dynahash.c

2025-08-18 Thread David Rowley
Remove HASH_DEBUG output from dynahash.c This existed in a semi broken stated from be0a6 until 296cba276. Recent discussion has questioned the value of having this at all as it only outputs static information from various of the hash table's properties when the hash table is created. Author:

pgsql: Use elog(DEBUG4) for dynahash.c statistics output

2025-08-18 Thread David Rowley
Use elog(DEBUG4) for dynahash.c statistics output Previously this was being output to stderr. This commit adjusts things to use elog(DEBUG4). Here we also adjust the format of the message to add the hash table name and also put the message on a single line. This should make grepping the logs fo

pgsql: Fix missing "use Test::More" in Kerberos.pm.

2025-08-18 Thread Tom Lane
Fix missing "use Test::More" in Kerberos.pm. Apparently the only Test::More function this script uses is BAIL_OUT, so this omission just results in the wrong error output appearing in the cases where it bails out. Seems to have been an oversight in commit 9f899562d which split Kerberos.pm out of

pgsql: Fix missing "use Test::More" in Kerberos.pm.

2025-08-18 Thread Tom Lane
Fix missing "use Test::More" in Kerberos.pm. Apparently the only Test::More function this script uses is BAIL_OUT, so this omission just results in the wrong error output appearing in the cases where it bails out. Seems to have been an oversight in commit 9f899562d which split Kerberos.pm out of

pgsql: Fix missing "use Test::More" in Kerberos.pm.

2025-08-18 Thread Tom Lane
Fix missing "use Test::More" in Kerberos.pm. Apparently the only Test::More function this script uses is BAIL_OUT, so this omission just results in the wrong error output appearing in the cases where it bails out. Seems to have been an oversight in commit 9f899562d which split Kerberos.pm out of

Re: pgsql: Move SQL-callable code related to multixacts into its own file

2025-08-18 Thread Tom Lane
Michael Paquier writes: > Move SQL-callable code related to multixacts into its own file Couldn't this have removed some #include-s from multixact.c? regards, tom lane

pgsql: Detect buffer underflow in get_th()

2025-08-18 Thread Peter Eisentraut
Detect buffer underflow in get_th() Input with zero length can result in a buffer underflow when accessing *(num + (len - 1)), as (len - 1) would produce a negative index. Add an assertion for zero-length input to prevent it. This was found by ALT Linux Team. Reviewing the call sites shows that