pgsql: pg_stat_statements: Add local_blk_{read|write}_time

2023-10-18 Thread Michael Paquier
pg_stat_statements: Add local_blk_{read|write}_time

This commit adds to pg_stat_statements the two new fields for local
buffers introduced by 295c36c0c1fa, adding the time spent to read and
write these blocks.  These are similar to what is done for temp and
shared blocks.  This information available only if track_io_timing is
enabled.

Like for 5a3423ad8ee17, no version bump is required in the module.

Author: Nazir Bilal Yavuz
Reviewed-by: Robert Haas, Melanie Plageman
Discussion: 
https://postgr.es/m/can55fz19ss279mzuqgbuunxka0ipblgyuoqxqakewrjnrp2...@mail.gmail.com

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/5147ab1dd34ad81c169c85fa3c7d11a782a1555b

Modified Files
--
.../pg_stat_statements/expected/oldextversions.out   |  2 ++
.../pg_stat_statements--1.10--1.11.sql   |  2 ++
contrib/pg_stat_statements/pg_stat_statements.c  | 15 +--
doc/src/sgml/pgstatstatements.sgml   | 20 
4 files changed, 37 insertions(+), 2 deletions(-)



pgsql: Add local_blk_{read|write}_time I/O timing statistics for local

2023-10-18 Thread Michael Paquier
Add local_blk_{read|write}_time I/O timing statistics for local blocks

There was no I/O timing statistics for counting read and write timings
on local blocks, contrary to the counterparts for temp and shared
blocks.  This information is available when track_io_timing is enabled.

The output of EXPLAIN is updated to show this information.  An update of
pg_stat_statements is planned next.

Author: Nazir Bilal Yavuz
Reviewed-by: Robert Haas, Melanie Plageman
Discussion: 
https://postgr.es/m/can55fz19ss279mzuqgbuunxka0ipblgyuoqxqakewrjnrp2...@mail.gmail.com

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/295c36c0c1fa7b6befd0a3525c7f109e838c9448

Modified Files
--
doc/src/sgml/ref/explain.sgml  |  4 ++--
src/backend/commands/explain.c | 23 ++-
src/backend/executor/instrument.c  |  6 ++
src/backend/utils/activity/pgstat_io.c |  4 
src/include/executor/instrument.h  |  2 ++
src/test/regress/expected/explain.out  |  4 
6 files changed, 40 insertions(+), 3 deletions(-)



pgsql: Rename I/O timing statistics columns to shared_blk_{read|write}_

2023-10-18 Thread Michael Paquier
Rename I/O timing statistics columns to shared_blk_{read|write}_time

These two counters, defined in BufferUsage to track respectively the
time spent while reading and writing blocks have historically only
tracked data related to shared buffers, when track_io_timing is enabled.

An upcoming patch to add specific counters for local buffers will take
advantage of this rename as it has come up that no data is currently
tracked for local buffers, and tracking local and shared buffers using
the same fields would be inconsistent with the treatment done for temp
buffers.  Renaming the existing fields clarifies what the block type of
each stats field is.

pg_stat_statement is updated to reflect the rename.  No extension
version bump is required as 5a3423ad8ee17 has done one, affecting v17~.

Author: Nazir Bilal Yavuz
Reviewed-by: Robert Haas, Melanie Plageman
Discussion: 
https://postgr.es/m/can55fz19ss279mzuqgbuunxka0ipblgyuoqxqakewrjnrp2...@mail.gmail.com

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/13d00729d422c84b1764c24251abcc785ea4adb1

Modified Files
--
.../pg_stat_statements/expected/oldextversions.out |   4 +-
.../pg_stat_statements--1.10--1.11.sql |   4 +-
contrib/pg_stat_statements/pg_stat_statements.c|  14 +--
doc/src/sgml/pgstatstatements.sgml |   8 +-
src/backend/commands/explain.c |  29 +++---
src/backend/executor/instrument.c  |  12 +--
src/backend/utils/activity/pgstat_io.c |   4 +-
src/include/executor/instrument.h  |   4 +-
src/test/regress/expected/explain.out  | 108 ++---
9 files changed, 95 insertions(+), 92 deletions(-)



pgsql: Improve pglz_decompress's defenses against corrupt compressed da

2023-10-18 Thread Tom Lane
Improve pglz_decompress's defenses against corrupt compressed data.

When processing a match tag, check to see if the claimed "off"
is more than the distance back to the output buffer start.
If it is, then the data is corrupt, and what's more we would
fetch from outside the buffer boundaries and potentially incur
a SIGSEGV.  (Although the odds of that seem relatively low, given
that "off" can't be more than 4K.)

Back-patch to v13; before that, this function wasn't really
trying to protect against bad data.

Report and fix by Flavien Guedez.

Discussion: 
https://postgr.es/m/01fc0593-e31e-463d-902c-dd43174ac...@oopacity.net

Branch
--
REL_14_STABLE

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

Modified Files
--
src/common/pg_lzcompress.c | 12 
1 file changed, 8 insertions(+), 4 deletions(-)



pgsql: Improve pglz_decompress's defenses against corrupt compressed da

2023-10-18 Thread Tom Lane
Improve pglz_decompress's defenses against corrupt compressed data.

When processing a match tag, check to see if the claimed "off"
is more than the distance back to the output buffer start.
If it is, then the data is corrupt, and what's more we would
fetch from outside the buffer boundaries and potentially incur
a SIGSEGV.  (Although the odds of that seem relatively low, given
that "off" can't be more than 4K.)

Back-patch to v13; before that, this function wasn't really
trying to protect against bad data.

Report and fix by Flavien Guedez.

Discussion: 
https://postgr.es/m/01fc0593-e31e-463d-902c-dd43174ac...@oopacity.net

Branch
--
REL_13_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/817669ea27c4ecc4240adc88a12ddaed51997b00

Modified Files
--
src/common/pg_lzcompress.c | 12 
1 file changed, 8 insertions(+), 4 deletions(-)



pgsql: Improve pglz_decompress's defenses against corrupt compressed da

2023-10-18 Thread Tom Lane
Improve pglz_decompress's defenses against corrupt compressed data.

When processing a match tag, check to see if the claimed "off"
is more than the distance back to the output buffer start.
If it is, then the data is corrupt, and what's more we would
fetch from outside the buffer boundaries and potentially incur
a SIGSEGV.  (Although the odds of that seem relatively low, given
that "off" can't be more than 4K.)

Back-patch to v13; before that, this function wasn't really
trying to protect against bad data.

Report and fix by Flavien Guedez.

Discussion: 
https://postgr.es/m/01fc0593-e31e-463d-902c-dd43174ac...@oopacity.net

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/9b103f861ea9d74c4c43e80c5c5dfcdc1e61f4a2

Modified Files
--
src/common/pg_lzcompress.c | 12 
1 file changed, 8 insertions(+), 4 deletions(-)



pgsql: Improve pglz_decompress's defenses against corrupt compressed da

2023-10-18 Thread Tom Lane
Improve pglz_decompress's defenses against corrupt compressed data.

When processing a match tag, check to see if the claimed "off"
is more than the distance back to the output buffer start.
If it is, then the data is corrupt, and what's more we would
fetch from outside the buffer boundaries and potentially incur
a SIGSEGV.  (Although the odds of that seem relatively low, given
that "off" can't be more than 4K.)

Back-patch to v13; before that, this function wasn't really
trying to protect against bad data.

Report and fix by Flavien Guedez.

Discussion: 
https://postgr.es/m/01fc0593-e31e-463d-902c-dd43174ac...@oopacity.net

Branch
--
REL_15_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/985ac5ce292ab084fe56b90528df6a2496f2c507

Modified Files
--
src/common/pg_lzcompress.c | 12 
1 file changed, 8 insertions(+), 4 deletions(-)



pgsql: Improve pglz_decompress's defenses against corrupt compressed da

2023-10-18 Thread Tom Lane
Improve pglz_decompress's defenses against corrupt compressed data.

When processing a match tag, check to see if the claimed "off"
is more than the distance back to the output buffer start.
If it is, then the data is corrupt, and what's more we would
fetch from outside the buffer boundaries and potentially incur
a SIGSEGV.  (Although the odds of that seem relatively low, given
that "off" can't be more than 4K.)

Back-patch to v13; before that, this function wasn't really
trying to protect against bad data.

Report and fix by Flavien Guedez.

Discussion: 
https://postgr.es/m/01fc0593-e31e-463d-902c-dd43174ac...@oopacity.net

Branch
--
REL_16_STABLE

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

Modified Files
--
src/common/pg_lzcompress.c | 12 
1 file changed, 8 insertions(+), 4 deletions(-)



pgsql: Install wait_event_types.h in VPATH builds

2023-10-18 Thread Michael Paquier
Install wait_event_types.h in VPATH builds

An extra rule is needed in src/include/Makefile for VPATH builds to
install any generated server-side include files, and wait_event_types.h
was forgotten from the set.

Issue introduced by fa88928470b5.

Reported-by: Christoph Berg
Discussion: https://postgr.es/m/ztaa11u7ctx6n...@msg.df7cb.de

Branch
--
master

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

Modified Files
--
src/include/Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)



pgsql: doc: PG 16 relnotes: fix spelling error

2023-10-18 Thread Bruce Momjian
doc:  PG 16 relnotes:  fix spelling error

Reported-by: Lele Gaifax

Discussion: https://postgr.es/m/87cyximsps@metapensiero.it

Backpatch-through: 16 only

Branch
--
REL_16_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/418d6b4430a5dbfbe4dd9c10ada367f0aee88b52

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



pgsql: jit: Changes for LLVM 17.

2023-10-18 Thread Thomas Munro
jit: Changes for LLVM 17.

Changes required by https://llvm.org/docs/NewPassManager.html.

Back-patch to 12, leaving the final release of 11 unchanged, consistent
with earlier decision not to back-patch LLVM 16 support either.

Author: Dmitry Dolgov <9erthali...@gmail.com>
Reviewed-by: Andres Freund 
Reviewed-by: Thomas Munro 
Discussion: 
https://postgr.es/m/CA%2BhUKG%2BWXznXCyTgCADd%3DHWkP9Qksa6chd7L%3DGCnZo-MBgg9Lg%40mail.gmail.com

Branch
--
REL_12_STABLE

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

Modified Files
--
src/backend/jit/llvm/llvmjit.c| 31 +++
src/backend/jit/llvm/llvmjit_wrap.cpp |  6 ++
2 files changed, 37 insertions(+)



pgsql: jit: Changes for LLVM 17.

2023-10-18 Thread Thomas Munro
jit: Changes for LLVM 17.

Changes required by https://llvm.org/docs/NewPassManager.html.

Back-patch to 12, leaving the final release of 11 unchanged, consistent
with earlier decision not to back-patch LLVM 16 support either.

Author: Dmitry Dolgov <9erthali...@gmail.com>
Reviewed-by: Andres Freund 
Reviewed-by: Thomas Munro 
Discussion: 
https://postgr.es/m/CA%2BhUKG%2BWXznXCyTgCADd%3DHWkP9Qksa6chd7L%3DGCnZo-MBgg9Lg%40mail.gmail.com

Branch
--
REL_13_STABLE

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

Modified Files
--
src/backend/jit/llvm/llvmjit.c| 31 +++
src/backend/jit/llvm/llvmjit_wrap.cpp |  6 ++
2 files changed, 37 insertions(+)



pgsql: jit: Changes for LLVM 17.

2023-10-18 Thread Thomas Munro
jit: Changes for LLVM 17.

Changes required by https://llvm.org/docs/NewPassManager.html.

Back-patch to 12, leaving the final release of 11 unchanged, consistent
with earlier decision not to back-patch LLVM 16 support either.

Author: Dmitry Dolgov <9erthali...@gmail.com>
Reviewed-by: Andres Freund 
Reviewed-by: Thomas Munro 
Discussion: 
https://postgr.es/m/CA%2BhUKG%2BWXznXCyTgCADd%3DHWkP9Qksa6chd7L%3DGCnZo-MBgg9Lg%40mail.gmail.com

Branch
--
REL_14_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/0a8b7d5c11266ba5291d0aafc0ff4f92ab1cc041

Modified Files
--
src/backend/jit/llvm/llvmjit.c| 31 +++
src/backend/jit/llvm/llvmjit_wrap.cpp |  6 ++
2 files changed, 37 insertions(+)



pgsql: jit: Changes for LLVM 17.

2023-10-18 Thread Thomas Munro
jit: Changes for LLVM 17.

Changes required by https://llvm.org/docs/NewPassManager.html.

Back-patch to 12, leaving the final release of 11 unchanged, consistent
with earlier decision not to back-patch LLVM 16 support either.

Author: Dmitry Dolgov <9erthali...@gmail.com>
Reviewed-by: Andres Freund 
Reviewed-by: Thomas Munro 
Discussion: 
https://postgr.es/m/CA%2BhUKG%2BWXznXCyTgCADd%3DHWkP9Qksa6chd7L%3DGCnZo-MBgg9Lg%40mail.gmail.com

Branch
--
REL_15_STABLE

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

Modified Files
--
src/backend/jit/llvm/llvmjit.c| 31 +++
src/backend/jit/llvm/llvmjit_wrap.cpp |  6 ++
2 files changed, 37 insertions(+)



pgsql: jit: Changes for LLVM 17.

2023-10-18 Thread Thomas Munro
jit: Changes for LLVM 17.

Changes required by https://llvm.org/docs/NewPassManager.html.

Back-patch to 12, leaving the final release of 11 unchanged, consistent
with earlier decision not to back-patch LLVM 16 support either.

Author: Dmitry Dolgov <9erthali...@gmail.com>
Reviewed-by: Andres Freund 
Reviewed-by: Thomas Munro 
Discussion: 
https://postgr.es/m/CA%2BhUKG%2BWXznXCyTgCADd%3DHWkP9Qksa6chd7L%3DGCnZo-MBgg9Lg%40mail.gmail.com

Branch
--
REL_16_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/774185056834eef7702f6afb37731c583fa51a1a

Modified Files
--
src/backend/jit/llvm/llvmjit.c| 31 +++
src/backend/jit/llvm/llvmjit_wrap.cpp |  6 ++
2 files changed, 37 insertions(+)



pgsql: jit: Changes for LLVM 17.

2023-10-18 Thread Thomas Munro
jit: Changes for LLVM 17.

Changes required by https://llvm.org/docs/NewPassManager.html.

Back-patch to 12, leaving the final release of 11 unchanged, consistent
with earlier decision not to back-patch LLVM 16 support either.

Author: Dmitry Dolgov <9erthali...@gmail.com>
Reviewed-by: Andres Freund 
Reviewed-by: Thomas Munro 
Discussion: 
https://postgr.es/m/CA%2BhUKG%2BWXznXCyTgCADd%3DHWkP9Qksa6chd7L%3DGCnZo-MBgg9Lg%40mail.gmail.com

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/76200e5ee469e4a9db5f9514b9d0c6a31b496bff

Modified Files
--
src/backend/jit/llvm/llvmjit.c| 31 +++
src/backend/jit/llvm/llvmjit_wrap.cpp |  6 ++
2 files changed, 37 insertions(+)



pgsql: jit: Supply LLVMGlobalGetValueType() for LLVM < 8.

2023-10-18 Thread Thomas Munro
jit: Supply LLVMGlobalGetValueType() for LLVM < 8.

Commit 37d5babb used this C API function while adding support for LLVM
16 and opaque pointers, but it's not available in LLVM 7 and older.
Provide it in our own llvmjit_wrap.cpp.  It just calls a C++ function
that pre-dates LLVM 3.9, our minimum target.

Back-patch to 12, like 37d5babb.

Discussion: 
https://postgr.es/m/CA%2BhUKGKnLnJnWrkr%3D4mSGhE5FuTK55FY15uULR7%3Dzzc%3DwX4Nqw%40mail.gmail.com

Branch
--
REL_12_STABLE

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

Modified Files
--
src/backend/jit/llvm/llvmjit_wrap.cpp | 8 
src/include/jit/llvmjit.h | 4 
2 files changed, 12 insertions(+)



pgsql: jit: Supply LLVMGlobalGetValueType() for LLVM < 8.

2023-10-18 Thread Thomas Munro
jit: Supply LLVMGlobalGetValueType() for LLVM < 8.

Commit 37d5babb used this C API function while adding support for LLVM
16 and opaque pointers, but it's not available in LLVM 7 and older.
Provide it in our own llvmjit_wrap.cpp.  It just calls a C++ function
that pre-dates LLVM 3.9, our minimum target.

Back-patch to 12, like 37d5babb.

Discussion: 
https://postgr.es/m/CA%2BhUKGKnLnJnWrkr%3D4mSGhE5FuTK55FY15uULR7%3Dzzc%3DwX4Nqw%40mail.gmail.com

Branch
--
REL_13_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/981292c19f387c5416294096a22507a54ca30136

Modified Files
--
src/backend/jit/llvm/llvmjit_wrap.cpp | 8 
src/include/jit/llvmjit.h | 4 
2 files changed, 12 insertions(+)



pgsql: jit: Supply LLVMGlobalGetValueType() for LLVM < 8.

2023-10-18 Thread Thomas Munro
jit: Supply LLVMGlobalGetValueType() for LLVM < 8.

Commit 37d5babb used this C API function while adding support for LLVM
16 and opaque pointers, but it's not available in LLVM 7 and older.
Provide it in our own llvmjit_wrap.cpp.  It just calls a C++ function
that pre-dates LLVM 3.9, our minimum target.

Back-patch to 12, like 37d5babb.

Discussion: 
https://postgr.es/m/CA%2BhUKGKnLnJnWrkr%3D4mSGhE5FuTK55FY15uULR7%3Dzzc%3DwX4Nqw%40mail.gmail.com

Branch
--
REL_14_STABLE

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

Modified Files
--
src/backend/jit/llvm/llvmjit_wrap.cpp | 8 
src/include/jit/llvmjit.h | 4 
2 files changed, 12 insertions(+)



pgsql: jit: Supply LLVMGlobalGetValueType() for LLVM < 8.

2023-10-18 Thread Thomas Munro
jit: Supply LLVMGlobalGetValueType() for LLVM < 8.

Commit 37d5babb used this C API function while adding support for LLVM
16 and opaque pointers, but it's not available in LLVM 7 and older.
Provide it in our own llvmjit_wrap.cpp.  It just calls a C++ function
that pre-dates LLVM 3.9, our minimum target.

Back-patch to 12, like 37d5babb.

Discussion: 
https://postgr.es/m/CA%2BhUKGKnLnJnWrkr%3D4mSGhE5FuTK55FY15uULR7%3Dzzc%3DwX4Nqw%40mail.gmail.com

Branch
--
REL_15_STABLE

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

Modified Files
--
src/backend/jit/llvm/llvmjit_wrap.cpp | 8 
src/include/jit/llvmjit.h | 4 
2 files changed, 12 insertions(+)



pgsql: jit: Supply LLVMGlobalGetValueType() for LLVM < 8.

2023-10-18 Thread Thomas Munro
jit: Supply LLVMGlobalGetValueType() for LLVM < 8.

Commit 37d5babb used this C API function while adding support for LLVM
16 and opaque pointers, but it's not available in LLVM 7 and older.
Provide it in our own llvmjit_wrap.cpp.  It just calls a C++ function
that pre-dates LLVM 3.9, our minimum target.

Back-patch to 12, like 37d5babb.

Discussion: 
https://postgr.es/m/CA%2BhUKGKnLnJnWrkr%3D4mSGhE5FuTK55FY15uULR7%3Dzzc%3DwX4Nqw%40mail.gmail.com

Branch
--
REL_16_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/60596f148a661e0fd1d7c1f13a72b55124511e3a

Modified Files
--
src/backend/jit/llvm/llvmjit_wrap.cpp | 8 
src/include/jit/llvmjit.h | 4 
2 files changed, 12 insertions(+)



pgsql: jit: Supply LLVMGlobalGetValueType() for LLVM < 8.

2023-10-18 Thread Thomas Munro
jit: Supply LLVMGlobalGetValueType() for LLVM < 8.

Commit 37d5babb used this C API function while adding support for LLVM
16 and opaque pointers, but it's not available in LLVM 7 and older.
Provide it in our own llvmjit_wrap.cpp.  It just calls a C++ function
that pre-dates LLVM 3.9, our minimum target.

Back-patch to 12, like 37d5babb.

Discussion: 
https://postgr.es/m/CA%2BhUKGKnLnJnWrkr%3D4mSGhE5FuTK55FY15uULR7%3Dzzc%3DwX4Nqw%40mail.gmail.com

Branch
--
master

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

Modified Files
--
src/backend/jit/llvm/llvmjit_wrap.cpp | 8 
src/include/jit/llvmjit.h | 4 
2 files changed, 12 insertions(+)



pgsql: jit: Support opaque pointers in LLVM 16.

2023-10-18 Thread Thomas Munro
jit: Support opaque pointers in LLVM 16.

Remove use of LLVMGetElementType() and provide the type of all pointers
to LLVMBuildXXX() functions when emitting IR, as required by modern LLVM
versions[1].

 * For LLVM <= 14, we'll still use the old LLVMBuildXXX() functions.
 * For LLVM == 15, we'll continue to do the same, explicitly opting
   out of opaque pointer mode.
 * For LLVM >= 16, we'll use the new LLVMBuildXXX2() functions that take
   the extra type argument.

The difference is hidden behind some new IR emitting wrapper functions
l_load(), l_gep(), l_call() etc.  The change is mostly mechanical,
except that at each site the correct type had to be provided.

In some places we needed to do some extra work to get functions types,
including some new wrappers for C++ APIs that are not yet exposed by in
LLVM's C API, and some new "example" functions in llvmjit_types.c
because it's no longer possible to start from the function pointer type
and ask for the function type.

Back-patch to 12, because it's a little tricker in 11 and we agreed not
to put the latest LLVM support into the upcoming final release of 11.

[1] https://llvm.org/docs/OpaquePointers.html

Reviewed-by: Dmitry Dolgov <9erthali...@gmail.com>
Reviewed-by: Ronan Dunklau 
Reviewed-by: Andres Freund 
Discussion: 
https://postgr.es/m/CA%2BhUKGKNX_%3Df%2B1C4r06WETKTq0G4Z_7q4L4Fxn5WWpMycDj9Fw%40mail.gmail.com

Branch
--
REL_12_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/15ddc9725eb73d97a16652c7c90d993302773544

Modified Files
--
src/backend/jit/llvm/llvmjit.c| 193 +++---
src/backend/jit/llvm/llvmjit_deform.c | 119 +
src/backend/jit/llvm/llvmjit_expr.c   | 471 +++---
src/backend/jit/llvm/llvmjit_types.c  |  27 +-
src/backend/jit/llvm/llvmjit_wrap.cpp |  12 +
src/include/jit/llvmjit.h |  20 +-
src/include/jit/llvmjit_emit.h| 106 ++--
7 files changed, 565 insertions(+), 383 deletions(-)



pgsql: jit: Support opaque pointers in LLVM 16.

2023-10-18 Thread Thomas Munro
jit: Support opaque pointers in LLVM 16.

Remove use of LLVMGetElementType() and provide the type of all pointers
to LLVMBuildXXX() functions when emitting IR, as required by modern LLVM
versions[1].

 * For LLVM <= 14, we'll still use the old LLVMBuildXXX() functions.
 * For LLVM == 15, we'll continue to do the same, explicitly opting
   out of opaque pointer mode.
 * For LLVM >= 16, we'll use the new LLVMBuildXXX2() functions that take
   the extra type argument.

The difference is hidden behind some new IR emitting wrapper functions
l_load(), l_gep(), l_call() etc.  The change is mostly mechanical,
except that at each site the correct type had to be provided.

In some places we needed to do some extra work to get functions types,
including some new wrappers for C++ APIs that are not yet exposed by in
LLVM's C API, and some new "example" functions in llvmjit_types.c
because it's no longer possible to start from the function pointer type
and ask for the function type.

Back-patch to 12, because it's a little tricker in 11 and we agreed not
to put the latest LLVM support into the upcoming final release of 11.

[1] https://llvm.org/docs/OpaquePointers.html

Reviewed-by: Dmitry Dolgov <9erthali...@gmail.com>
Reviewed-by: Ronan Dunklau 
Reviewed-by: Andres Freund 
Discussion: 
https://postgr.es/m/CA%2BhUKGKNX_%3Df%2B1C4r06WETKTq0G4Z_7q4L4Fxn5WWpMycDj9Fw%40mail.gmail.com

Branch
--
REL_13_STABLE

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

Modified Files
--
src/backend/jit/llvm/llvmjit.c| 130 ++-
src/backend/jit/llvm/llvmjit_deform.c | 119 +-
src/backend/jit/llvm/llvmjit_expr.c   | 400 --
src/backend/jit/llvm/llvmjit_types.c  |  25 +++
src/backend/jit/llvm/llvmjit_wrap.cpp |  12 +
src/include/jit/llvmjit.h |   7 +
src/include/jit/llvmjit_emit.h| 106 ++---
7 files changed, 502 insertions(+), 297 deletions(-)



pgsql: jit: Support opaque pointers in LLVM 16.

2023-10-18 Thread Thomas Munro
jit: Support opaque pointers in LLVM 16.

Remove use of LLVMGetElementType() and provide the type of all pointers
to LLVMBuildXXX() functions when emitting IR, as required by modern LLVM
versions[1].

 * For LLVM <= 14, we'll still use the old LLVMBuildXXX() functions.
 * For LLVM == 15, we'll continue to do the same, explicitly opting
   out of opaque pointer mode.
 * For LLVM >= 16, we'll use the new LLVMBuildXXX2() functions that take
   the extra type argument.

The difference is hidden behind some new IR emitting wrapper functions
l_load(), l_gep(), l_call() etc.  The change is mostly mechanical,
except that at each site the correct type had to be provided.

In some places we needed to do some extra work to get functions types,
including some new wrappers for C++ APIs that are not yet exposed by in
LLVM's C API, and some new "example" functions in llvmjit_types.c
because it's no longer possible to start from the function pointer type
and ask for the function type.

Back-patch to 12, because it's a little tricker in 11 and we agreed not
to put the latest LLVM support into the upcoming final release of 11.

[1] https://llvm.org/docs/OpaquePointers.html

Reviewed-by: Dmitry Dolgov <9erthali...@gmail.com>
Reviewed-by: Ronan Dunklau 
Reviewed-by: Andres Freund 
Discussion: 
https://postgr.es/m/CA%2BhUKGKNX_%3Df%2B1C4r06WETKTq0G4Z_7q4L4Fxn5WWpMycDj9Fw%40mail.gmail.com

Branch
--
REL_14_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/82d9a782a29633a7d2c8c0785e4162a46f93d23b

Modified Files
--
src/backend/jit/llvm/llvmjit.c|  57 ++---
src/backend/jit/llvm/llvmjit_deform.c | 119 +-
src/backend/jit/llvm/llvmjit_expr.c   | 397 --
src/backend/jit/llvm/llvmjit_types.c  |  39 +++-
src/backend/jit/llvm/llvmjit_wrap.cpp |  12 +
src/include/jit/llvmjit.h |   6 +
src/include/jit/llvmjit_emit.h| 106 ++---
7 files changed, 475 insertions(+), 261 deletions(-)



pgsql: jit: Support opaque pointers in LLVM 16.

2023-10-18 Thread Thomas Munro
jit: Support opaque pointers in LLVM 16.

Remove use of LLVMGetElementType() and provide the type of all pointers
to LLVMBuildXXX() functions when emitting IR, as required by modern LLVM
versions[1].

 * For LLVM <= 14, we'll still use the old LLVMBuildXXX() functions.
 * For LLVM == 15, we'll continue to do the same, explicitly opting
   out of opaque pointer mode.
 * For LLVM >= 16, we'll use the new LLVMBuildXXX2() functions that take
   the extra type argument.

The difference is hidden behind some new IR emitting wrapper functions
l_load(), l_gep(), l_call() etc.  The change is mostly mechanical,
except that at each site the correct type had to be provided.

In some places we needed to do some extra work to get functions types,
including some new wrappers for C++ APIs that are not yet exposed by in
LLVM's C API, and some new "example" functions in llvmjit_types.c
because it's no longer possible to start from the function pointer type
and ask for the function type.

Back-patch to 12, because it's a little tricker in 11 and we agreed not
to put the latest LLVM support into the upcoming final release of 11.

[1] https://llvm.org/docs/OpaquePointers.html

Reviewed-by: Dmitry Dolgov <9erthali...@gmail.com>
Reviewed-by: Ronan Dunklau 
Reviewed-by: Andres Freund 
Discussion: 
https://postgr.es/m/CA%2BhUKGKNX_%3Df%2B1C4r06WETKTq0G4Z_7q4L4Fxn5WWpMycDj9Fw%40mail.gmail.com

Branch
--
REL_15_STABLE

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

Modified Files
--
src/backend/jit/llvm/llvmjit.c|  57 ++---
src/backend/jit/llvm/llvmjit_deform.c | 119 +-
src/backend/jit/llvm/llvmjit_expr.c   | 397 --
src/backend/jit/llvm/llvmjit_types.c  |  39 +++-
src/backend/jit/llvm/llvmjit_wrap.cpp |  12 +
src/include/jit/llvmjit.h |   7 +
src/include/jit/llvmjit_emit.h| 106 ++---
7 files changed, 476 insertions(+), 261 deletions(-)



pgsql: jit: Support opaque pointers in LLVM 16.

2023-10-18 Thread Thomas Munro
jit: Support opaque pointers in LLVM 16.

Remove use of LLVMGetElementType() and provide the type of all pointers
to LLVMBuildXXX() functions when emitting IR, as required by modern LLVM
versions[1].

 * For LLVM <= 14, we'll still use the old LLVMBuildXXX() functions.
 * For LLVM == 15, we'll continue to do the same, explicitly opting
   out of opaque pointer mode.
 * For LLVM >= 16, we'll use the new LLVMBuildXXX2() functions that take
   the extra type argument.

The difference is hidden behind some new IR emitting wrapper functions
l_load(), l_gep(), l_call() etc.  The change is mostly mechanical,
except that at each site the correct type had to be provided.

In some places we needed to do some extra work to get functions types,
including some new wrappers for C++ APIs that are not yet exposed by in
LLVM's C API, and some new "example" functions in llvmjit_types.c
because it's no longer possible to start from the function pointer type
and ask for the function type.

Back-patch to 12, because it's a little tricker in 11 and we agreed not
to put the latest LLVM support into the upcoming final release of 11.

[1] https://llvm.org/docs/OpaquePointers.html

Reviewed-by: Dmitry Dolgov <9erthali...@gmail.com>
Reviewed-by: Ronan Dunklau 
Reviewed-by: Andres Freund 
Discussion: 
https://postgr.es/m/CA%2BhUKGKNX_%3Df%2B1C4r06WETKTq0G4Z_7q4L4Fxn5WWpMycDj9Fw%40mail.gmail.com

Branch
--
REL_16_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/74d19ec096dfbda5782e62892de7e86a104f8265

Modified Files
--
src/backend/jit/llvm/llvmjit.c|  57 ++---
src/backend/jit/llvm/llvmjit_deform.c | 119 +-
src/backend/jit/llvm/llvmjit_expr.c   | 401 --
src/backend/jit/llvm/llvmjit_types.c  |  39 +++-
src/backend/jit/llvm/llvmjit_wrap.cpp |  12 +
src/backend/jit/llvm/meson.build  |   2 +-
src/include/jit/llvmjit.h |   7 +
src/include/jit/llvmjit_emit.h| 106 ++---
8 files changed, 479 insertions(+), 264 deletions(-)



pgsql: jit: Support opaque pointers in LLVM 16.

2023-10-18 Thread Thomas Munro
jit: Support opaque pointers in LLVM 16.

Remove use of LLVMGetElementType() and provide the type of all pointers
to LLVMBuildXXX() functions when emitting IR, as required by modern LLVM
versions[1].

 * For LLVM <= 14, we'll still use the old LLVMBuildXXX() functions.
 * For LLVM == 15, we'll continue to do the same, explicitly opting
   out of opaque pointer mode.
 * For LLVM >= 16, we'll use the new LLVMBuildXXX2() functions that take
   the extra type argument.

The difference is hidden behind some new IR emitting wrapper functions
l_load(), l_gep(), l_call() etc.  The change is mostly mechanical,
except that at each site the correct type had to be provided.

In some places we needed to do some extra work to get functions types,
including some new wrappers for C++ APIs that are not yet exposed by in
LLVM's C API, and some new "example" functions in llvmjit_types.c
because it's no longer possible to start from the function pointer type
and ask for the function type.

Back-patch to 12, because it's a little tricker in 11 and we agreed not
to put the latest LLVM support into the upcoming final release of 11.

[1] https://llvm.org/docs/OpaquePointers.html

Reviewed-by: Dmitry Dolgov <9erthali...@gmail.com>
Reviewed-by: Ronan Dunklau 
Reviewed-by: Andres Freund 
Discussion: 
https://postgr.es/m/CA%2BhUKGKNX_%3Df%2B1C4r06WETKTq0G4Z_7q4L4Fxn5WWpMycDj9Fw%40mail.gmail.com

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/37d5babb5cfa4c6795b3cb6de964ba019d3d60ab

Modified Files
--
src/backend/jit/llvm/llvmjit.c|  59 ++---
src/backend/jit/llvm/llvmjit_deform.c | 119 +-
src/backend/jit/llvm/llvmjit_expr.c   | 401 --
src/backend/jit/llvm/llvmjit_types.c  |  39 +++-
src/backend/jit/llvm/llvmjit_wrap.cpp |  12 +
src/backend/jit/llvm/meson.build  |   2 +-
src/include/jit/llvmjit.h |   7 +
src/include/jit/llvmjit_emit.h| 106 ++---
8 files changed, 481 insertions(+), 264 deletions(-)



pgsql: pg_upgrade: Fix test name in 002_pg_upgrade.pl

2023-10-18 Thread Michael Paquier
pg_upgrade: Fix test name in 002_pg_upgrade.pl

Author: Hou Zhijie
Discussion: 
https://postgr.es/m/tyapr01mb5724a40d47e71f4717357ec694...@tyapr01mb5724.jpnprd01.prod.outlook.com
Backpatch-through: 15

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/3f9b1f26ca0eee46affcf1b0fd83c4217dec40db

Modified Files
--
src/bin/pg_upgrade/t/002_pg_upgrade.pl | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)



pgsql: pg_upgrade: Fix test name in 002_pg_upgrade.pl

2023-10-18 Thread Michael Paquier
pg_upgrade: Fix test name in 002_pg_upgrade.pl

Author: Hou Zhijie
Discussion: 
https://postgr.es/m/tyapr01mb5724a40d47e71f4717357ec694...@tyapr01mb5724.jpnprd01.prod.outlook.com
Backpatch-through: 15

Branch
--
REL_15_STABLE

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

Modified Files
--
src/bin/pg_upgrade/t/002_pg_upgrade.pl | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)



pgsql: pg_upgrade: Fix test name in 002_pg_upgrade.pl

2023-10-18 Thread Michael Paquier
pg_upgrade: Fix test name in 002_pg_upgrade.pl

Author: Hou Zhijie
Discussion: 
https://postgr.es/m/tyapr01mb5724a40d47e71f4717357ec694...@tyapr01mb5724.jpnprd01.prod.outlook.com
Backpatch-through: 15

Branch
--
REL_16_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/4277bcb30129dcf61e355ae97509c002f82c674e

Modified Files
--
src/bin/pg_upgrade/t/002_pg_upgrade.pl | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)



pgsql: Clean up some pg_dump tests

2023-10-18 Thread Peter Eisentraut
Clean up some pg_dump tests

1) Remove useless entries from "unlike" lists.  Runs that are not
   listed in "like" don't need to be excluded in "unlike".

2) Ensure there is always a "like" list, even if it is empty.  This
   makes the test more self-documenting.

3) Use predefined lists such as %full_runs where appropriate, instead
   of listing all runs separately.

Also add code that checks 1 and 2 automatically and dies with an error
for violations.

Reviewed-by: Alvaro Herrera 
Discussion: 
https://www.postgresql.org/message-id/flat/1f8cb371-e84e-434e-0367-6b716fb16...@eisentraut.org

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/41a284411e09a3c0a401cd5ab81fbf1802fe8021

Modified Files
--
src/bin/pg_dump/t/002_pg_dump.pl | 78 +++-
1 file changed, 21 insertions(+), 57 deletions(-)