pgsql: Avoid useless ReplicationOriginExitCleanup locking

2024-01-15 Thread Alvaro Herrera
Avoid useless ReplicationOriginExitCleanup locking

When session_replication_state is NULL, we can know there's nothing to
do with no lock acquisition.  Do that.

Author: Bharath Rupireddy 
Discussion: 
https://postgr.es/m/calj2acx+yaeru5xjqr4c7klsto_f7dbrnf8wgehvjzcktnu...@mail.gmail.com

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/aa817c7496575b37fde6ea5e0cd65b26f29ea532

Modified Files
--
src/backend/replication/logical/origin.c | 13 -
1 file changed, 8 insertions(+), 5 deletions(-)



pgsql: Fix 'negative bitmapset member' error

2024-01-15 Thread Alexander Korotkov
Fix 'negative bitmapset member' error

When removing a useless join, we'd remove PHVs that are not used at join
partner rels or above the join.  A PHV that references the join's relid
in ph_eval_at is logically "above" the join and thus should not be
removed.  We have the following check for that:

!bms_is_member(ojrelid, phinfo->ph_eval_at)

However, in the case of SJE removing a useless inner join, 'ojrelid' is
set to -1, which would trigger the "negative bitmapset member not
allowed" error in bms_is_member().

Fix it by skipping examining ojrelid for inner joins in this check.

Reported-by: Zuming Jiang
Bug: #18260
Discussion: https://postgr.es/m/18260-1b6a0c4ae311b837%40postgresql.org
Author: Richard Guo
Reviewed-by: Andrei Lepikhov

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/fe093994db4dc5dcc239f8839b094c0b75de00cf

Modified Files
--
src/backend/optimizer/plan/analyzejoins.c |  2 +-
src/test/regress/expected/join.out| 20 
src/test/regress/sql/join.sql |  8 
3 files changed, 29 insertions(+), 1 deletion(-)



pgsql: Fix typos.

2024-01-15 Thread Robert Haas
Fix typos.

Alexander Lakhin

Discussion: http://postgr.es/m/212b0987-83e5-e2ae-c5e8-b8170fdaf...@gmail.com

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/237d01139b8a2ad26036d9025ae8e8e99b53e08c

Modified Files
--
doc/src/sgml/func.sgml| 2 +-
src/bin/pg_walsummary/t/002_blocks.pl | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)



pgsql: Fix a typo and some doc indentation related to libpq pipeline fu

2024-01-15 Thread Michael Paquier
Fix a typo and some doc indentation related to libpq pipeline functions

Noticed while reviewing the area for a different patch.  This is
cosmetic, so no backpatch is done.

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/83eb244e419efd43959fdd544ff8c30e175565ef

Modified Files
--
doc/src/sgml/libpq.sgml| 36 ++--
src/interfaces/libpq/fe-exec.c |  2 +-
2 files changed, 19 insertions(+), 19 deletions(-)



pgsql: libpq: Add PQsendPipelineSync()

2024-01-15 Thread Michael Paquier
libpq: Add PQsendPipelineSync()

This new function is equivalent to PQpipelineSync(), except that it does
not flush anything to the server except if the size threshold of the
output buffer is reached; the user must subsequently call PQflush()
instead.

Its purpose is to reduce the system call overhead of pipeline mode, by
giving to applications more control over the timing of the flushes when
manipulating commands in pipeline mode.

Author: Anton Kirilov
Reviewed-by: Jelte Fennema-Nio, Robert Haas, Álvaro Herrera, Denis
Laxalde, Michael Paquier
Discussion: 
https://postgr.es/m/CACV6eE5arHFZEA717=ikea_oewpvffwjomsodgrqqsr8cjv...@mail.gmail.com

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/4794c2d31714235700ed68edafa10d1928c9bbb2

Modified Files
--
doc/src/sgml/libpq.sgml| 45 +++---
src/interfaces/libpq/exports.txt   |  1 +
src/interfaces/libpq/fe-exec.c | 54 ++
src/interfaces/libpq/libpq-fe.h|  1 +
src/test/modules/libpq_pipeline/libpq_pipeline.c   | 43 +
.../libpq_pipeline/traces/multi_pipelines.trace| 11 +
6 files changed, 138 insertions(+), 17 deletions(-)



Re: pgsql: Re-validate connection string in libpqrcv_connect().

2024-01-15 Thread Tom Lane
Jeff Davis  writes:
>> Re-validate connection string in libpqrcv_connect().

> Looks like the test is causing problems on drogo:

> ERROR:  could not connect to the publisher: connection to server at
> "127.0.0.1", port 54707 failed: FATAL:  SSPI authentication failed for
> user "regress_test_user"'

I might be wrong, but I think the problem is lack of an auth_extra
setting for that role.  See for example 1e3f461e8.

regards, tom lane