pgsql: Revert "libpqwalreceiver: Convert to libpq-be-fe-helpers.h"

2024-01-23 Thread Heikki Linnakangas
Revert "libpqwalreceiver: Convert to libpq-be-fe-helpers.h"

This reverts commit 728f86fec65537eade8d9e751961782ddb527934.

The signal handling was a few bricks shy of a load in that commit,
which made the walreceiver non-responsive to SIGTERM while it was
waiting for the connection to be established. That prevented a standby
from being promoted.

Since it was non-essential refactoring, let's revert it to make v16
work the same as earlier releases. I reverted it in 'master' too, to
keep the branches in sync. The refactoring was a good idea as such,
but it needs a bit more work. Once we have developed a complete patch
with this issue fixed, let's re-apply that to 'master'.

Reported-by: Kyotaro Horiguchi
Backpatch-through: 16
Discussion: 
https://www.postgresql.org/message-id/20231231.200741.1078989336605759878.horikyota@gmail.com

Branch
--
REL_16_STABLE

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

Modified Files
--
.../libpqwalreceiver/libpqwalreceiver.c| 55 ++
1 file changed, 47 insertions(+), 8 deletions(-)



pgsql: Revert "libpqwalreceiver: Convert to libpq-be-fe-helpers.h"

2024-01-23 Thread Heikki Linnakangas
Revert "libpqwalreceiver: Convert to libpq-be-fe-helpers.h"

This reverts commit 728f86fec65537eade8d9e751961782ddb527934.

The signal handling was a few bricks shy of a load in that commit,
which made the walreceiver non-responsive to SIGTERM while it was
waiting for the connection to be established. That prevented a standby
from being promoted.

Since it was non-essential refactoring, let's revert it to make v16
work the same as earlier releases. I reverted it in 'master' too, to
keep the branches in sync. The refactoring was a good idea as such,
but it needs a bit more work. Once we have developed a complete patch
with this issue fixed, let's re-apply that to 'master'.

Reported-by: Kyotaro Horiguchi
Backpatch-through: 16
Discussion: 
https://www.postgresql.org/message-id/20231231.200741.1078989336605759878.horikyota@gmail.com

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/21ef4d4d897563adb2f7920ad53b734950f1e0a4

Modified Files
--
.../libpqwalreceiver/libpqwalreceiver.c| 55 ++
1 file changed, 47 insertions(+), 8 deletions(-)



pgsql: meson: portname was set too early

2024-01-23 Thread Peter Eisentraut
meson: portname was set too early

portname is set to host_system, but host_system might still be changed
later in the file.  As a consequence, platforms where host_system is
changed later wouldn't find some of their platform-specific files
(driven by portname), and the build would fail.  Move the assignment
of portname further down after the last change of host_system (but
before further overriding assignments to portname).

Discussion: 
https://www.postgresql.org/message-id/flat/CAC7zN94TdsHhY88XkroJzSMx7E%3DBQpV9LKKjNSEnTM04ihoWCA%40mail.gmail.com

Branch
--
master

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

Modified Files
--
meson.build | 12 ++--
1 file changed, 6 insertions(+), 6 deletions(-)



pgsql: meson: portname was set too early

2024-01-23 Thread Peter Eisentraut
meson: portname was set too early

portname is set to host_system, but host_system might still be changed
later in the file.  As a consequence, platforms where host_system is
changed later wouldn't find some of their platform-specific files
(driven by portname), and the build would fail.  Move the assignment
of portname further down after the last change of host_system (but
before further overriding assignments to portname).

Discussion: 
https://www.postgresql.org/message-id/flat/CAC7zN94TdsHhY88XkroJzSMx7E%3DBQpV9LKKjNSEnTM04ihoWCA%40mail.gmail.com

Branch
--
REL_16_STABLE

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

Modified Files
--
meson.build | 12 ++--
1 file changed, 6 insertions(+), 6 deletions(-)



pgsql: doc: Add acronym and glossary term for Access Method

2024-01-23 Thread Daniel Gustafsson
doc: Add acronym and glossary term for Access Method

AM was used throughout the documentation to denote Access Method, but
the acronym was not described.  This adds an acronym entry as well as
a glossary term which the acronym links to.  Each page which describe
AMs have the first occurrence with  markup.

Reported-by: alaa.atty...@gmail.com
Reviewed-by: Alvaro Herrera 
Discussion: 
https://postgr.es/m/169974408805.398198.6927340566912872...@wrigleys.postgresql.org

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/68387f9bdc82a56bf56945da3883a993bc40e2a5

Modified Files
--
doc/src/sgml/acronyms.sgml |  9 +
doc/src/sgml/btree.sgml|  2 +-
doc/src/sgml/glossary.sgml | 15 +++
doc/src/sgml/indexam.sgml  |  2 +-
doc/src/sgml/tableam.sgml  |  2 +-
5 files changed, 27 insertions(+), 3 deletions(-)



Re: pgsql: Generate syscache info from catalog files

2024-01-23 Thread Tom Lane
Peter Eisentraut  writes:
> Generate syscache info from catalog files

Per guaibasaurus[1], this commit broke "make dist":

...
rm -rf tmp_install/ portlock/
rm -f config.cache config.log config.status GNUmakefile
make[1]: Leaving directory 
'/home/pgsql/buildfarm/buildroot/HEAD/pgsql.build/postgresql-17devel'
/bin/tar chf postgresql-17devel.tar postgresql-17devel
/bin/tar: postgresql-17devel/src/include/catalog/syscache_ids.h: File removed 
before we read it
/bin/tar: postgresql-17devel/src/include/catalog/syscache_info.h: File removed 
before we read it
make: *** [GNUmakefile:94: postgresql-17devel.tar] Error 1
make: *** Deleting file 'postgresql-17devel.tar'

I'm not sure why --- the makefile changes treat these new files
exactly like other generated files.  It doesn't repro here,
either, which is odd.  It looks like a timing problem, but how
could there be one?

regards, tom lane

[1] 
https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=guaibasaurus&dt=2024-01-23%2012%3A20%3A03




Re: pgsql: Generate syscache info from catalog files

2024-01-23 Thread Tom Lane
I wrote:
> Peter Eisentraut  writes:
>> Generate syscache info from catalog files

> Per guaibasaurus[1], this commit broke "make dist":
> ...
> I'm not sure why --- the makefile changes treat these new files
> exactly like other generated files.  It doesn't repro here,
> either, which is odd.  It looks like a timing problem, but how
> could there be one?

Even odder: I did a test tarball build, and that worked too.
That runs on the very same VM as guaibasaurus, so what the heck?

regards, tom lane




Re: pgsql: Generate syscache info from catalog files

2024-01-23 Thread Peter Eisentraut

On 23.01.24 15:08, Tom Lane wrote:

Peter Eisentraut  writes:

Generate syscache info from catalog files


Per guaibasaurus[1], this commit broke "make dist":

...
rm -rf tmp_install/ portlock/
rm -f config.cache config.log config.status GNUmakefile
make[1]: Leaving directory 
'/home/pgsql/buildfarm/buildroot/HEAD/pgsql.build/postgresql-17devel'
/bin/tar chf postgresql-17devel.tar postgresql-17devel
/bin/tar: postgresql-17devel/src/include/catalog/syscache_ids.h: File removed 
before we read it
/bin/tar: postgresql-17devel/src/include/catalog/syscache_info.h: File removed 
before we read it
make: *** [GNUmakefile:94: postgresql-17devel.tar] Error 1
make: *** Deleting file 'postgresql-17devel.tar'

I'm not sure why --- the makefile changes treat these new files
exactly like other generated files.  It doesn't repro here,
either, which is odd.  It looks like a timing problem, but how
could there be one?


I have found that the files are not listed in the clean target in 
src/include/Makefile.  That might explain it, but it's gotta be fixed 
anyway.  I'll go ahead with that.






pgsql: Fix makefiles for newly added files

2024-01-23 Thread Peter Eisentraut
Fix makefiles for newly added files

The new files added in 9b1a6f50b9 need to be mentioned in a few more
places in the makefiles.

Discussion: 
https://www.postgresql.org/message-id/flat/E1rSAY2-002hIk-4y%40gemulon.postgresql.org

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/6eb6086faa3842c2a38a1ee2f97bf9a42ce27610

Modified Files
--
src/include/Makefile | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)



Re: pgsql: Generate syscache info from catalog files

2024-01-23 Thread Tom Lane
Peter Eisentraut  writes:
> On 23.01.24 15:08, Tom Lane wrote:
>> Per guaibasaurus[1], this commit broke "make dist":
>> I'm not sure why --- the makefile changes treat these new files
>> exactly like other generated files.  It doesn't repro here,
>> either, which is odd.  It looks like a timing problem, but how
>> could there be one?

> I have found that the files are not listed in the clean target in 
> src/include/Makefile.  That might explain it, but it's gotta be fixed 
> anyway.  I'll go ahead with that.

Looks like that made guaibasaurus happy, but I'm still mystified
as to what was wrong and why it didn't repro elsewhere.

regards, tom lane




pgsql: meson: Map host_system android to linux

2024-01-23 Thread Peter Eisentraut
meson: Map host_system android to linux

This appears to be what is missing to support builds on Android (with
meson).

Author: Andres Freund 
Discussion: 
https://www.postgresql.org/message-id/flat/CAC7zN94TdsHhY88XkroJzSMx7E%3DBQpV9LKKjNSEnTM04ihoWCA%40mail.gmail.com

Branch
--
master

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

Modified Files
--
meson.build | 4 
1 file changed, 4 insertions(+)



pgsql: Support shared libraries on Android (using make)

2024-01-23 Thread Peter Eisentraut
Support shared libraries on Android (using make)

While the rest of the make build system maps Android to Linux, Android
uses unversioned shared libraries (like "libpq.so").  This patch makes
it so.  (Meson already supported it.)

Reported-by: Matthias Kuhn 
Discussion: 
https://www.postgresql.org/message-id/flat/CAC7zN94TdsHhY88XkroJzSMx7E%3DBQpV9LKKjNSEnTM04ihoWCA%40mail.gmail.com

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/79b03dbb3304539c6599593397c6a6b63b6a6ad9

Modified Files
--
src/Makefile.shlib | 5 +
1 file changed, 5 insertions(+)



pgsql: Fix crash in autoprewarm.

2024-01-23 Thread Nathan Bossart
Fix crash in autoprewarm.

Commit abb0b4fc03 moved the shared state for autoprewarm to a
dynamic shared memory (DSM) segment, but it left apw_detach_shmem()
in the on_shmem_exit callback list for the autoprewarm leader
process.  This is a problem because shmem_exit() detaches all the
DSM segments prior to calling the on_shmem_exit callbacks, thus
producing segfaults in the exit path for the autoprewarm leader
process.

To fix, move apw_detach_shmem() to the before_shmem_exit callback
list.  This commit also adds a check to pg_prewarm's test that the
server shut down normally.  It might be worth making this a common
check for all shutdowns in TAP tests, but that is left as a future
exercise.

Reported-by: Andres Freund
Reviewed-by: Andres Freund, Álvaro Herrera
Discussion: 
https://postgr.es/m/20240122204117.swton324xcoodnyi%40awork3.anarazel.de

Branch
--
master

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

Modified Files
--
contrib/pg_prewarm/autoprewarm.c  | 10 --
contrib/pg_prewarm/t/001_basic.pl |  6 ++
2 files changed, 14 insertions(+), 2 deletions(-)



pgsql: Fix ALTER TABLE .. ADD COLUMN with complex inheritance trees

2024-01-23 Thread Michael Paquier
Fix ALTER TABLE .. ADD COLUMN with complex inheritance trees

This command, when used to add a column on a parent table with a complex
inheritance tree, tried to update multiple times the same tuple in
pg_attribute for a child table when incrementing attinhcount, causing
failures with "tuple already updated by self" because of a missing
CommandCounterIncrement() between two updates.

This exists for a rather long time, so backpatch all the way down.

Reported-by: Alexander Lakhin
Author: Tender Wang
Reviewed-by: Richard Guo
Discussion: https://postgr.es/m/18297-b04cd83a55b51...@postgresql.org
Backpatch-through: 12

Branch
--
REL_15_STABLE

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

Modified Files
--
src/backend/commands/tablecmds.c  |  4 
src/test/regress/expected/inherit.out | 17 +
src/test/regress/sql/inherit.sql  |  9 +
3 files changed, 30 insertions(+)



pgsql: Fix ALTER TABLE .. ADD COLUMN with complex inheritance trees

2024-01-23 Thread Michael Paquier
Fix ALTER TABLE .. ADD COLUMN with complex inheritance trees

This command, when used to add a column on a parent table with a complex
inheritance tree, tried to update multiple times the same tuple in
pg_attribute for a child table when incrementing attinhcount, causing
failures with "tuple already updated by self" because of a missing
CommandCounterIncrement() between two updates.

This exists for a rather long time, so backpatch all the way down.

Reported-by: Alexander Lakhin
Author: Tender Wang
Reviewed-by: Richard Guo
Discussion: https://postgr.es/m/18297-b04cd83a55b51...@postgresql.org
Backpatch-through: 12

Branch
--
REL_12_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/2f724283719e75261d3b649d20235e4f1542be04

Modified Files
--
src/backend/commands/tablecmds.c  |  4 
src/test/regress/expected/inherit.out | 17 +
src/test/regress/sql/inherit.sql  |  9 +
3 files changed, 30 insertions(+)



pgsql: Fix ALTER TABLE .. ADD COLUMN with complex inheritance trees

2024-01-23 Thread Michael Paquier
Fix ALTER TABLE .. ADD COLUMN with complex inheritance trees

This command, when used to add a column on a parent table with a complex
inheritance tree, tried to update multiple times the same tuple in
pg_attribute for a child table when incrementing attinhcount, causing
failures with "tuple already updated by self" because of a missing
CommandCounterIncrement() between two updates.

This exists for a rather long time, so backpatch all the way down.

Reported-by: Alexander Lakhin
Author: Tender Wang
Reviewed-by: Richard Guo
Discussion: https://postgr.es/m/18297-b04cd83a55b51...@postgresql.org
Backpatch-through: 12

Branch
--
master

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

Modified Files
--
src/backend/commands/tablecmds.c  |  4 
src/test/regress/expected/inherit.out | 17 +
src/test/regress/sql/inherit.sql  |  9 +
3 files changed, 30 insertions(+)



pgsql: Fix ALTER TABLE .. ADD COLUMN with complex inheritance trees

2024-01-23 Thread Michael Paquier
Fix ALTER TABLE .. ADD COLUMN with complex inheritance trees

This command, when used to add a column on a parent table with a complex
inheritance tree, tried to update multiple times the same tuple in
pg_attribute for a child table when incrementing attinhcount, causing
failures with "tuple already updated by self" because of a missing
CommandCounterIncrement() between two updates.

This exists for a rather long time, so backpatch all the way down.

Reported-by: Alexander Lakhin
Author: Tender Wang
Reviewed-by: Richard Guo
Discussion: https://postgr.es/m/18297-b04cd83a55b51...@postgresql.org
Backpatch-through: 12

Branch
--
REL_16_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/51193e7a7d333e2f19048c97a336da436b7d97e9

Modified Files
--
src/backend/commands/tablecmds.c  |  4 
src/test/regress/expected/inherit.out | 17 +
src/test/regress/sql/inherit.sql  |  9 +
3 files changed, 30 insertions(+)



pgsql: Fix ALTER TABLE .. ADD COLUMN with complex inheritance trees

2024-01-23 Thread Michael Paquier
Fix ALTER TABLE .. ADD COLUMN with complex inheritance trees

This command, when used to add a column on a parent table with a complex
inheritance tree, tried to update multiple times the same tuple in
pg_attribute for a child table when incrementing attinhcount, causing
failures with "tuple already updated by self" because of a missing
CommandCounterIncrement() between two updates.

This exists for a rather long time, so backpatch all the way down.

Reported-by: Alexander Lakhin
Author: Tender Wang
Reviewed-by: Richard Guo
Discussion: https://postgr.es/m/18297-b04cd83a55b51...@postgresql.org
Backpatch-through: 12

Branch
--
REL_13_STABLE

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

Modified Files
--
src/backend/commands/tablecmds.c  |  4 
src/test/regress/expected/inherit.out | 17 +
src/test/regress/sql/inherit.sql  |  9 +
3 files changed, 30 insertions(+)



pgsql: Fix ALTER TABLE .. ADD COLUMN with complex inheritance trees

2024-01-23 Thread Michael Paquier
Fix ALTER TABLE .. ADD COLUMN with complex inheritance trees

This command, when used to add a column on a parent table with a complex
inheritance tree, tried to update multiple times the same tuple in
pg_attribute for a child table when incrementing attinhcount, causing
failures with "tuple already updated by self" because of a missing
CommandCounterIncrement() between two updates.

This exists for a rather long time, so backpatch all the way down.

Reported-by: Alexander Lakhin
Author: Tender Wang
Reviewed-by: Richard Guo
Discussion: https://postgr.es/m/18297-b04cd83a55b51...@postgresql.org
Backpatch-through: 12

Branch
--
REL_14_STABLE

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

Modified Files
--
src/backend/commands/tablecmds.c  |  4 
src/test/regress/expected/inherit.out | 17 +
src/test/regress/sql/inherit.sql  |  9 +
3 files changed, 30 insertions(+)



pgsql: Add soft error handling to some expression nodes

2024-01-23 Thread Amit Langote
Add soft error handling to some expression nodes

This adjusts the code for CoerceViaIO and CoerceToDomain expression
nodes to handle errors softly.

For CoerceViaIo, this adds a new ExprEvalStep opcode
EEOP_IOCOERCE_SAFE, which is implemented in the new accompanying
function ExecEvalCoerceViaIOSafe().  The only difference from
EEOP_IOCOERCE's inline implementation is that the input function
receives an ErrorSaveContext via the function's
FunctionCallInfo.context, which it can use to handle errors softly.

For CoerceToDomain, this simply entails replacing the ereport() in
ExecEvalConstraintNotNull() and ExecEvalConstraintCheck() by
errsave() passing it the ErrorSaveContext passed in the expression's
ExprEvalStep.

In both cases, the ErrorSaveContext to be used is passed by setting
ExprState.escontext to point to it before calling ExecInitExprRec()
on the expression tree whose errors are to be handled softly.

Note that there's no functional change as of this commit as no call
site of ExecInitExprRec() has been changed.  This is intended for
implementing new SQL/JSON expression nodes in future commits.

Extracted from a much larger patch to add SQL/JSON query functions.

Author: Nikita Glukhov 
Author: Teodor Sigaev 
Author: Oleg Bartunov 
Author: Alexander Korotkov 
Author: Andrew Dunstan 
Author: Amit Langote 

Reviewers have included (in no particular order) Andres Freund,
Alexander Korotkov, Pavel Stehule, Andrew Alsup, Erik Rijkers,
Zihong Yu, Himanshu Upadhyaya, Daniel Gustafsson, Justin Pryzby,
Álvaro Herrera, Jian He, Peter Eisentraut

Discussion: 
https://postgr.es/m/cd0bb935-0158-78a7-08b5-904886dea...@postgrespro.ru
Discussion: 
https://postgr.es/m/20220616233130.rparivafipt6d...@alap3.anarazel.de
Discussion: 
https://postgr.es/m/abd9b83b-aa66-f230-3d6d-734817f0995d%40postgresql.org
Discussion: 
https://postgr.es/m/ca+hiwqhropf9e644d8brqyvaapmgbzvup-xkmdpk-nd4epg...@mail.gmail.com
Discussion: 
https://postgr.es/m/CA+HiwqE4XTdfb1nW=ojoy_tqsrhyt-q_kb6i5d4xckyrlc1...@mail.gmail.com

Branch
--
master

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

Modified Files
--
src/backend/executor/execExpr.c   |  8 +++-
src/backend/executor/execExprInterp.c | 80 ++-
src/backend/jit/llvm/llvmjit_expr.c   |  6 +++
src/backend/jit/llvm/llvmjit_types.c  |  1 +
src/include/executor/execExpr.h   |  4 ++
src/include/nodes/execnodes.h |  7 +++
6 files changed, 103 insertions(+), 3 deletions(-)



pgsql: Adjust populate_record_field() to handle errors softly

2024-01-23 Thread Amit Langote
Adjust populate_record_field() to handle errors softly

This adds a Node *escontext parameter to it and a bunch of functions
downstream to it, replacing any ereport()s in that path by either
errsave() or ereturn() as appropriate.  This also adds code to those
functions where necessary to return early upon encountering a soft
error.

The changes here are mainly intended to suppress errors in the
functions of jsonfuncs.c.  Functions in any external modules, such as
arrayfuncs.c, that those functions may in turn call are not changed
here based on the assumption that the various checks in jsonfuncs.c
functions should ensure that only values that are structurally valid
get passed to the functions in those external modules.  An exception
is made for domain_check() to allow handling domain constraint
violation errors softly.

For testing, this adds a function jsonb_populate_record_valid(),
which returns true if jsonb_populate_record() would finish without
causing an error for the provided JSON object, false otherwise.  Note
that jsonb_populate_record() internally calls populate_record(),
which in turn uses populate_record_field().

Extracted from a much larger patch to add SQL/JSON query functions.

Author: Nikita Glukhov 
Author: Teodor Sigaev 
Author: Oleg Bartunov 
Author: Alexander Korotkov 
Author: Andrew Dunstan 
Author: Amit Langote 

Reviewers have included (in no particular order) Andres Freund,
Alexander Korotkov, Pavel Stehule, Andrew Alsup, Erik Rijkers,
Zihong Yu, Himanshu Upadhyaya, Daniel Gustafsson, Justin Pryzby,
Álvaro Herrera, Jian He, Peter Eisentraut

Discussion: 
https://postgr.es/m/cd0bb935-0158-78a7-08b5-904886dea...@postgrespro.ru
Discussion: 
https://postgr.es/m/20220616233130.rparivafipt6d...@alap3.anarazel.de
Discussion: 
https://postgr.es/m/abd9b83b-aa66-f230-3d6d-734817f0995d%40postgresql.org
Discussion: 
https://postgr.es/m/ca+hiwqhropf9e644d8brqyvaapmgbzvup-xkmdpk-nd4epg...@mail.gmail.com
Discussion: 
https://postgr.es/m/CA+HiwqE4XTdfb1nW=ojoy_tqsrhyt-q_kb6i5d4xckyrlc1...@mail.gmail.com

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/1edb3b491bee373bdfcbfc1c2707b5428c2023b9

Modified Files
--
doc/src/sgml/func.sgml  |  52 ++
src/backend/utils/adt/domains.c |  33 +++-
src/backend/utils/adt/jsonfuncs.c   | 364 +++-
src/include/catalog/pg_proc.dat |   4 +
src/include/utils/builtins.h|   3 +
src/test/regress/expected/jsonb.out | 115 
src/test/regress/sql/jsonb.sql  |  37 
7 files changed, 521 insertions(+), 87 deletions(-)



pgsql: Refactor code used by jsonpath executor to fetch variables

2024-01-23 Thread Amit Langote
Refactor code used by jsonpath executor to fetch variables

Currently, getJsonPathVariable() directly extracts a named
variable/key from the source Jsonb value.  This commit puts that
logic into a callback function called by getJsonPathVariable().
Other implementations of the callback may accept different forms
of the source value(s), for example, a List of values passed from
outside jsonpath_exec.c.

Extracted from a much larger patch to add SQL/JSON query functions.

Author: Nikita Glukhov 
Author: Teodor Sigaev 
Author: Oleg Bartunov 
Author: Alexander Korotkov 
Author: Andrew Dunstan 
Author: Amit Langote 

Reviewers have included (in no particular order) Andres Freund,
Alexander Korotkov, Pavel Stehule, Andrew Alsup, Erik Rijkers,
Zihong Yu, Himanshu Upadhyaya, Daniel Gustafsson, Justin Pryzby,
Álvaro Herrera, Jian He, Peter Eisentraut

Discussion: 
https://postgr.es/m/cd0bb935-0158-78a7-08b5-904886dea...@postgrespro.ru
Discussion: 
https://postgr.es/m/20220616233130.rparivafipt6d...@alap3.anarazel.de
Discussion: 
https://postgr.es/m/abd9b83b-aa66-f230-3d6d-734817f0995d%40postgresql.org
Discussion: 
https://postgr.es/m/ca+hiwqhropf9e644d8brqyvaapmgbzvup-xkmdpk-nd4epg...@mail.gmail.com
Discussion: 
https://postgr.es/m/CA+HiwqE4XTdfb1nW=ojoy_tqsrhyt-q_kb6i5d4xckyrlc1...@mail.gmail.com

Branch
--
master

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

Modified Files
--
src/backend/utils/adt/jsonpath_exec.c | 136 +-
1 file changed, 99 insertions(+), 37 deletions(-)



pgsql: pgbench: Add \syncpipeline

2024-01-23 Thread Michael Paquier
pgbench: Add \syncpipeline

This change adds a new meta-command called \syncpipeline to pgbench,
able to send a sync message without flushing using the new libpq
function PQsendPipelineSync().

This meta-command is available within a block made of \startpipeline and
\endpipeline.

Author: Anthonin Bonnefoy
Discussion: 
https://postgr.es/m/cao6_xqpcnhw6lzhlf-2nppzdtbymm4-rvkr3+ap5coksm9h...@mail.gmail.com

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/94edfe250c6a200d2067b0debfe00b4122e9b11e

Modified Files
--
doc/src/sgml/ref/pgbench.sgml| 12 +++---
src/bin/pgbench/pgbench.c| 28 +++---
src/bin/pgbench/t/001_pgbench_with_server.pl | 36 
3 files changed, 70 insertions(+), 6 deletions(-)