pgsql: Make GIN tests using injection points concurrent-safe

2024-04-09 Thread Michael Paquier
Make GIN tests using injection points concurrent-safe

f587338dec87 has introduced in the test module injection_points a SQL
function called injection_points_set_local(), that can be used to make
all the injection points linked to the process where they are attached,
discarded automatically if any remain once the process exits.

e2e3b8ae9ed7 has added a NO_INSTALLCHECK to the test module to prevent
the use of installcheck.  Now that there is a way to make the test
concurrent-safe, let's use it and remove the installcheck restriction.

Concurrency issues could be easily reproduced by running in a tight
loop a command like this one, in src/test/modules/gin/ (hardcoding
pg_sleep() after attaching injection points enlarges the race window)
and a second test suite like contrib/btree_gin/:

  make installcheck USE_MODULE_DB=1

Reviewed-by: Andrey Borodin
Discussion: https://postgr.es/m/zhng4io9uyogw...@paquier.xyz

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/5105c90796811f62711538155d207e5311eacf9b

Modified Files
--
src/test/modules/gin/Makefile   | 3 ---
src/test/modules/gin/expected/gin_incomplete_splits.out | 7 +++
src/test/modules/gin/meson.build| 2 --
src/test/modules/gin/sql/gin_incomplete_splits.sql  | 3 +++
4 files changed, 10 insertions(+), 5 deletions(-)



pgsql: Fix a test in failover slots regression test.

2024-04-09 Thread Amit Kapila
Fix a test in failover slots regression test.

Wait for the standby to catch up before syncing the slots with
pg_sync_replication_slots(), otherwise, the logical slot could be ahead
and the sync would fail.

The other way to fix the test is to change it to use slotsync worker and
poll for the sync to get finished but the current approach is better as
this is a predictable way to write the test.

Per buildfarm

Author: Hou Zhijie
Reviewed-by: Amit Kapila
Discussion: 
https://postgr.es/m/os0pr01mb571665359f2f5dcd3adabc9f94...@os0pr01mb5716.jpnprd01.prod.outlook.com

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/7e85d1c75f299b0772fbeb145706e019629530bd

Modified Files
--
src/test/recovery/t/040_standby_failover_slots_sync.pl | 10 --
1 file changed, 8 insertions(+), 2 deletions(-)



pgsql: Fix illegal attribute propagation in LLVM JIT.

2024-04-09 Thread Thomas Munro
Fix illegal attribute propagation in LLVM JIT.

Commit 72559438 started copying more attributes from AttributeTemplate
to the functions we generate on the fly.  In the case of deform
functions, which return void, this meant that "noundef", from
AttributeTemplate's return value (a Datum) was copied to a void type.
Older LLVM releases were OK with that, but LLVM 18 crashes.

Update our llvm_copy_attributes() function to skip copying the attribute
for the return value, if the target function returns void.

Thanks to Dmitry Dolgov for help chasing this down.

Back-patch to all supported releases, like 72559438.

Reported-by: Pavel Stehule 
Reviewed-by: Dmitry Dolgov <9erthali...@gmail.com>
Discussion: 
https://postgr.es/m/CAFj8pRACpVFr7LMdVYENUkScG5FCYMZDDdSGNU-tch%2Bw98OxYg%40mail.gmail.com

Branch
--
REL_12_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/01b55203ace02bb02049cd147f63b407f3911ca5

Modified Files
--
src/backend/jit/llvm/llvmjit.c | 7 +--
1 file changed, 5 insertions(+), 2 deletions(-)



pgsql: Fix illegal attribute propagation in LLVM JIT.

2024-04-09 Thread Thomas Munro
Fix illegal attribute propagation in LLVM JIT.

Commit 72559438 started copying more attributes from AttributeTemplate
to the functions we generate on the fly.  In the case of deform
functions, which return void, this meant that "noundef", from
AttributeTemplate's return value (a Datum) was copied to a void type.
Older LLVM releases were OK with that, but LLVM 18 crashes.

Update our llvm_copy_attributes() function to skip copying the attribute
for the return value, if the target function returns void.

Thanks to Dmitry Dolgov for help chasing this down.

Back-patch to all supported releases, like 72559438.

Reported-by: Pavel Stehule 
Reviewed-by: Dmitry Dolgov <9erthali...@gmail.com>
Discussion: 
https://postgr.es/m/CAFj8pRACpVFr7LMdVYENUkScG5FCYMZDDdSGNU-tch%2Bw98OxYg%40mail.gmail.com

Branch
--
REL_13_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/4f90750b53266e561dfcb6956d5d045d8d4b7b94

Modified Files
--
src/backend/jit/llvm/llvmjit.c | 7 +--
1 file changed, 5 insertions(+), 2 deletions(-)



pgsql: Fix illegal attribute propagation in LLVM JIT.

2024-04-09 Thread Thomas Munro
Fix illegal attribute propagation in LLVM JIT.

Commit 72559438 started copying more attributes from AttributeTemplate
to the functions we generate on the fly.  In the case of deform
functions, which return void, this meant that "noundef", from
AttributeTemplate's return value (a Datum) was copied to a void type.
Older LLVM releases were OK with that, but LLVM 18 crashes.

Update our llvm_copy_attributes() function to skip copying the attribute
for the return value, if the target function returns void.

Thanks to Dmitry Dolgov for help chasing this down.

Back-patch to all supported releases, like 72559438.

Reported-by: Pavel Stehule 
Reviewed-by: Dmitry Dolgov <9erthali...@gmail.com>
Discussion: 
https://postgr.es/m/CAFj8pRACpVFr7LMdVYENUkScG5FCYMZDDdSGNU-tch%2Bw98OxYg%40mail.gmail.com

Branch
--
REL_14_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/7fe32eaa4a878500280ed7d33ce711c06b6939ff

Modified Files
--
src/backend/jit/llvm/llvmjit.c | 7 +--
1 file changed, 5 insertions(+), 2 deletions(-)



pgsql: Fix illegal attribute propagation in LLVM JIT.

2024-04-09 Thread Thomas Munro
Fix illegal attribute propagation in LLVM JIT.

Commit 72559438 started copying more attributes from AttributeTemplate
to the functions we generate on the fly.  In the case of deform
functions, which return void, this meant that "noundef", from
AttributeTemplate's return value (a Datum) was copied to a void type.
Older LLVM releases were OK with that, but LLVM 18 crashes.

Update our llvm_copy_attributes() function to skip copying the attribute
for the return value, if the target function returns void.

Thanks to Dmitry Dolgov for help chasing this down.

Back-patch to all supported releases, like 72559438.

Reported-by: Pavel Stehule 
Reviewed-by: Dmitry Dolgov <9erthali...@gmail.com>
Discussion: 
https://postgr.es/m/CAFj8pRACpVFr7LMdVYENUkScG5FCYMZDDdSGNU-tch%2Bw98OxYg%40mail.gmail.com

Branch
--
REL_15_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/74992929a79e2606fbc4d579c3fad04a890eda04

Modified Files
--
src/backend/jit/llvm/llvmjit.c | 7 +--
1 file changed, 5 insertions(+), 2 deletions(-)



pgsql: Fix illegal attribute propagation in LLVM JIT.

2024-04-09 Thread Thomas Munro
Fix illegal attribute propagation in LLVM JIT.

Commit 72559438 started copying more attributes from AttributeTemplate
to the functions we generate on the fly.  In the case of deform
functions, which return void, this meant that "noundef", from
AttributeTemplate's return value (a Datum) was copied to a void type.
Older LLVM releases were OK with that, but LLVM 18 crashes.

Update our llvm_copy_attributes() function to skip copying the attribute
for the return value, if the target function returns void.

Thanks to Dmitry Dolgov for help chasing this down.

Back-patch to all supported releases, like 72559438.

Reported-by: Pavel Stehule 
Reviewed-by: Dmitry Dolgov <9erthali...@gmail.com>
Discussion: 
https://postgr.es/m/CAFj8pRACpVFr7LMdVYENUkScG5FCYMZDDdSGNU-tch%2Bw98OxYg%40mail.gmail.com

Branch
--
REL_16_STABLE

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

Modified Files
--
src/backend/jit/llvm/llvmjit.c | 7 +--
1 file changed, 5 insertions(+), 2 deletions(-)



pgsql: Fix illegal attribute propagation in LLVM JIT.

2024-04-09 Thread Thomas Munro
Fix illegal attribute propagation in LLVM JIT.

Commit 72559438 started copying more attributes from AttributeTemplate
to the functions we generate on the fly.  In the case of deform
functions, which return void, this meant that "noundef", from
AttributeTemplate's return value (a Datum) was copied to a void type.
Older LLVM releases were OK with that, but LLVM 18 crashes.

Update our llvm_copy_attributes() function to skip copying the attribute
for the return value, if the target function returns void.

Thanks to Dmitry Dolgov for help chasing this down.

Back-patch to all supported releases, like 72559438.

Reported-by: Pavel Stehule 
Reviewed-by: Dmitry Dolgov <9erthali...@gmail.com>
Discussion: 
https://postgr.es/m/CAFj8pRACpVFr7LMdVYENUkScG5FCYMZDDdSGNU-tch%2Bw98OxYg%40mail.gmail.com

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/53c8d6c9f157f2bc8211b8de02417e55fefddbc7

Modified Files
--
src/backend/jit/llvm/llvmjit.c | 7 +--
1 file changed, 5 insertions(+), 2 deletions(-)



pgsql: Fixup various StringInfo function usages

2024-04-09 Thread David Rowley
Fixup various StringInfo function usages

This adjusts various appendStringInfo* function calls to use a more
appropriate and efficient function with the same behavior.  For example,
use appendStringInfoChar() when appending a single character rather than
appendStringInfo() and appendStringInfoString() when no formatting is
required rather than using appendStringInfo().

All adjustments made here are in code that's new to v17, so it makes
sense to fix these now rather than wait a few years and make
backpatching harder.

Discussion: 
https://postgr.es/m/caaphdvojy2uvmio+9_55artj10p1lbnjyyogb+c65bldnt0...@mail.gmail.com
Reviewed-by: Nathan Bossart, Tom Lane

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/8461424fd717877ead0706984ef9b6440b2a97ad

Modified Files
--
contrib/postgres_fdw/deparse.c  |  4 ++--
src/backend/replication/logical/slotsync.c  |  2 +-
src/backend/replication/logical/tablesync.c |  2 +-
src/backend/utils/adt/ri_triggers.c |  8 
src/backend/utils/adt/ruleutils.c   | 20 ++--
5 files changed, 18 insertions(+), 18 deletions(-)



pgsql: revert: Transform OR clauses to ANY expression

2024-04-09 Thread Alexander Korotkov
revert: Transform OR clauses to ANY expression

This commit reverts 72bd38cc99 due to implementation and design issues.

Reported-by: Tom Lane
Discussion: https://postgr.es/m/3604469.1712628736%40sss.pgh.pa.us

Branch
--
master

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

Modified Files
--
doc/src/sgml/config.sgml  |  57 
src/backend/nodes/queryjumblefuncs.c  |  27 --
src/backend/optimizer/prep/prepqual.c | 400 +-
src/backend/utils/misc/guc_tables.c   |  12 -
src/backend/utils/misc/postgresql.conf.sample |   1 -
src/include/nodes/queryjumble.h   |   1 -
src/include/optimizer/optimizer.h |   2 -
src/test/regress/expected/create_index.out| 159 --
src/test/regress/expected/join.out|  50 
src/test/regress/expected/partition_prune.out |  37 ++-
src/test/regress/sql/create_index.sql |  45 ---
src/test/regress/sql/join.sql |  11 -
src/test/regress/sql/partition_prune.sql  |   2 -
src/tools/pgindent/typedefs.list  |   2 -
14 files changed, 20 insertions(+), 786 deletions(-)



Re: pgsql: Introduce a bump memory allocator

2024-04-09 Thread David Rowley
On Wed, 10 Apr 2024 at 00:05, Peter Eisentraut  wrote:
> This patch introduces in bump.c the macro BumpBlockIsValid(), but it's
> not used anywhere.  Can we remove it?

I've just pushed a patch to remove it.

Was that spotted by eagle eyes or tooling?

David




pgsql: Remove unused BumpBlockIsValid macro

2024-04-09 Thread David Rowley
Remove unused BumpBlockIsValid macro

The bump allocator was recently added in 29f6a959c.  Our other
allocators have a similar macro to this, but seemingly the version of
the macro for those allocators is only used in places where the chunk
header is decoded.  Since the bump allocator has no chunk header, none
of those functions exist for bump therefore macro is unused.  Remove it.

Reported-by: Peter Eisentraut
Discussion: 
https://postgr.es/m/5f724fb2-96e1-4f36-b65b-47b337ad4...@eisentraut.org

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/5a15bdea3b791223b4cc708d4953a0086f4332a6

Modified Files
--
src/backend/utils/mmgr/bump.c | 7 ---
1 file changed, 7 deletions(-)



pgsql: Checks for ALTER TABLE ... SPLIT/MERGE PARTITIONS ... commands

2024-04-09 Thread Alexander Korotkov
Checks for ALTER TABLE ... SPLIT/MERGE PARTITIONS ... commands

Check that the target partition actually belongs to the parent table.

Reported-by: Alexander Lakhin
Discussion: https://postgr.es/m/cd842601-cf1a-9806-f7b7-d2509b93ba61%40gmail.com
Author: Dmitry Koval

Branch
--
master

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

Modified Files
--
src/backend/commands/tablecmds.c  | 12 -
src/backend/parser/parse_utilcmd.c| 39 +++
src/test/regress/expected/partition_merge.out | 29 +++-
src/test/regress/expected/partition_split.out | 13 +
src/test/regress/sql/partition_merge.sql  | 24 ++---
src/test/regress/sql/partition_split.sql  | 15 +++
6 files changed, 111 insertions(+), 21 deletions(-)



pgsql: Doc: use "an SQL" instead of "a SQL"

2024-04-09 Thread David Rowley
Doc: use "an SQL" instead of "a SQL"

Although which is correct depends entirely on whether you pronounce SQL
as "ess-que-ell" or "sequel", we have standardized on the former in our
user-facing documentation, so use the correct article according to that
pronunciation.

Discussion: 
https://postgr.es/m/caaphdvp3osqwqam+wntp9bdhp+qfwo6ay6ztixqqmfm-uar...@mail.gmail.com

Branch
--
master

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

Modified Files
--
doc/src/sgml/ddl.sgml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)



pgsql: doc: Remove stray comma from list of psql options

2024-04-09 Thread Daniel Gustafsson
doc: Remove stray comma from list of psql options

Back in 7.2 the list of options had short options and long options
on the same line separated by comma, but since 7.3 they are listed
separate lines. The comma on -X was left behind so fix by removing
and backpatching all the way.

Reported-by: y.sabu...@gmail.com
Discussion: 
https://postgr.es/m/171267154345.684.7212826057932148...@wrigleys.postgresql.org
Backpatch-through: v12

Branch
--
REL_12_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/8d9714bbaab8c58e94c66d9e63f98c3c06b17e85

Modified Files
--
doc/src/sgml/ref/psql-ref.sgml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)



pgsql: doc: Remove stray comma from list of psql options

2024-04-09 Thread Daniel Gustafsson
doc: Remove stray comma from list of psql options

Back in 7.2 the list of options had short options and long options
on the same line separated by comma, but since 7.3 they are listed
separate lines. The comma on -X was left behind so fix by removing
and backpatching all the way.

Reported-by: y.sabu...@gmail.com
Discussion: 
https://postgr.es/m/171267154345.684.7212826057932148...@wrigleys.postgresql.org
Backpatch-through: v12

Branch
--
REL_13_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/8ebda5952a13ff8d53f89ebc87922da7e0eef729

Modified Files
--
doc/src/sgml/ref/psql-ref.sgml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)



pgsql: doc: Remove stray comma from list of psql options

2024-04-09 Thread Daniel Gustafsson
doc: Remove stray comma from list of psql options

Back in 7.2 the list of options had short options and long options
on the same line separated by comma, but since 7.3 they are listed
separate lines. The comma on -X was left behind so fix by removing
and backpatching all the way.

Reported-by: y.sabu...@gmail.com
Discussion: 
https://postgr.es/m/171267154345.684.7212826057932148...@wrigleys.postgresql.org
Backpatch-through: v12

Branch
--
REL_14_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/1435cc87d3a793a239d63bf7b20d35faba05f28f

Modified Files
--
doc/src/sgml/ref/psql-ref.sgml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)



pgsql: doc: Remove stray comma from list of psql options

2024-04-09 Thread Daniel Gustafsson
doc: Remove stray comma from list of psql options

Back in 7.2 the list of options had short options and long options
on the same line separated by comma, but since 7.3 they are listed
separate lines. The comma on -X was left behind so fix by removing
and backpatching all the way.

Reported-by: y.sabu...@gmail.com
Discussion: 
https://postgr.es/m/171267154345.684.7212826057932148...@wrigleys.postgresql.org
Backpatch-through: v12

Branch
--
REL_15_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/6304ee667759852083197c425668ae381ba82c22

Modified Files
--
doc/src/sgml/ref/psql-ref.sgml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)



pgsql: doc: Remove stray comma from list of psql options

2024-04-09 Thread Daniel Gustafsson
doc: Remove stray comma from list of psql options

Back in 7.2 the list of options had short options and long options
on the same line separated by comma, but since 7.3 they are listed
separate lines. The comma on -X was left behind so fix by removing
and backpatching all the way.

Reported-by: y.sabu...@gmail.com
Discussion: 
https://postgr.es/m/171267154345.684.7212826057932148...@wrigleys.postgresql.org
Backpatch-through: v12

Branch
--
REL_16_STABLE

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

Modified Files
--
doc/src/sgml/ref/psql-ref.sgml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)



pgsql: doc: Remove stray comma from list of psql options

2024-04-09 Thread Daniel Gustafsson
doc: Remove stray comma from list of psql options

Back in 7.2 the list of options had short options and long options
on the same line separated by comma, but since 7.3 they are listed
separate lines. The comma on -X was left behind so fix by removing
and backpatching all the way.

Reported-by: y.sabu...@gmail.com
Discussion: 
https://postgr.es/m/171267154345.684.7212826057932148...@wrigleys.postgresql.org
Backpatch-through: v12

Branch
--
master

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

Modified Files
--
doc/src/sgml/ref/psql-ref.sgml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)



pgsql: Fix incorrect format placeholders

2024-04-09 Thread Peter Eisentraut
Fix incorrect format placeholders

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/27074bce08e994daf6b8fe9a84877ac257210fdd

Modified Files
--
src/backend/commands/explain.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)



pgsql: Update config.guess and config.sub

2024-04-09 Thread Peter Eisentraut
Update config.guess and config.sub

Branch
--
master

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

Modified Files
--
config/config.guess |  62 +++---
config/config.sub   | 232 +---
2 files changed, 198 insertions(+), 96 deletions(-)



Re: pgsql: Introduce a bump memory allocator

2024-04-09 Thread Peter Eisentraut

On 07.04.24 14:03, David Rowley wrote:

Introduce a bump memory allocator


This patch introduces in bump.c the macro BumpBlockIsValid(), but it's 
not used anywhere.  Can we remove it?


(If we don't remove it, I suggest to make it an inline function, so it's 
easier to tell what it's supposed to be called with.  Especially with 
the BumpIsValid() nearby, it can be a bit confusing.)






pgsql: Fix whitespace

2024-04-09 Thread Peter Eisentraut
Fix whitespace

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/43a9cab4844b9c933f1a24e24a38311ee24deefd

Modified Files
--
doc/src/sgml/ddl.sgml| 2 +-
src/test/modules/test_json_parser/t/003_test_semantic.pl | 6 --
2 files changed, 1 insertion(+), 7 deletions(-)



pgsql: Get rid of anonymous struct

2024-04-09 Thread John Naylor
Get rid of anonymous struct

This is a C11 feature, and we require C99. While at it, go the further
step and get rid of the surrounding union (with uintptr_t) entirely,
as there is currently no use case for this file to access the header of
BlocktableEntry as a uintptr_t, and there are no additional alignment
requirements. The least invasive way seems to be to transfer the old
union name to this struct.

Reported by Pavel Borisov and Andres Freund, per buildfarm member mylodon
Reviewed by Pavel Borisov

Discussion: 
https://postgr.es/m/CALT9ZEH11NYV8AOzKb1bWhCf6J0H=h31f0mgt9xx+hdqvca...@mail.gmail.com

Branch
--
master

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

Modified Files
--
src/backend/access/common/tidstore.c | 43 ++--
1 file changed, 21 insertions(+), 22 deletions(-)



Re: pgsql: With gssencmode='require', check credential cache before connect

2024-04-09 Thread Kyotaro Horiguchi
At Tue, 9 Apr 2024 08:14:53 +0300, Heikki Linnakangas  wrote 
in 
> On 09/04/2024 04:46, Kyotaro Horiguchi wrote:
> > Hello.
> > At Sun, 07 Apr 2024 23:50:08 +, Heikki Linnakangas
> >  wrote in
> >> With gssencmode='require', check credential cache before connecting
> > This commit adds the following error message (indentations are
> > adjusted):
> > +   libpq_append_conn_error(conn,
> > + "GSSAPI encryption required but it is not supported over a local
> > socket)");
> > The closing parenthesis at the end of the message seems to be a
> > leftover from editing.
> 
> Fixed, thanks!
> 
> > About the following message:
> > + libpq_append_conn_error(conn, "could not set ssl alpn extension:
> > %s", err);
> > I'm not sure about the policy for writing acronyms in lowercase, but
> > other occurrences of ALPN (in backend code) seem to be written in
> > uppercase.
> 
> Changed to uppercase. I also changed "ssl" to uppercase, for
> consistency with the "could not set SSL Server Name Indication (SNI)"
> message earlier.

(I didn't consider SSL..)

> To be even more consistent, we should perhaps spell out "SSL
> Application-Layer Protocol Negotiation (ALPN)", but that's pretty long
> and I don't think it really helps the user. It really should not fail,
> and there isn't anything the user can really do if that fails. Anyone
> who doesn't already know what ALPN is will need to google it anyway.

I think so, too.

regards.

-- 
Kyotaro Horiguchi
NTT Open Source Software Center