pgsql: Allow to enable failover property for replication slots via SQL

2024-01-24 Thread Amit Kapila
Allow to enable failover property for replication slots via SQL API.

This commit adds the failover property to the replication slot. The
failover property indicates whether the slot will be synced to the standby
servers, enabling the resumption of corresponding logical replication
after failover. But note that this commit does not yet include the
capability to sync the replication slot; the subsequent commits will add
that capability.

A new optional parameter 'failover' is added to the
pg_create_logical_replication_slot() function. We will also enable to set
'failover' option for slots via the subscription commands in the
subsequent commits.

The value of the 'failover' flag is displayed as part of
pg_replication_slots view.

Author: Hou Zhijie, Shveta Malik, Ajin Cherian
Reviewed-by: Peter Smith, Bertrand Drouvot, Dilip Kumar, Masahiko Sawada, Nisha 
Moond, Kuroda, Hayato, Amit Kapila
Discussion: 
https://postgr.es/m/514f6f2f-6833-4539-39f1-96cd1e011...@enterprisedb.com

Branch
--
master

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

Modified Files
--
contrib/test_decoding/expected/slot.out  | 58 
contrib/test_decoding/sql/slot.sql   | 13 +++
doc/src/sgml/func.sgml   | 11 --
doc/src/sgml/system-views.sgml   | 10 ++
src/backend/catalog/system_functions.sql |  1 +
src/backend/catalog/system_views.sql |  3 +-
src/backend/replication/slot.c   |  8 +++--
src/backend/replication/slotfuncs.c  | 16 +++--
src/backend/replication/walsender.c  |  4 +--
src/bin/pg_upgrade/info.c|  5 ++-
src/bin/pg_upgrade/pg_upgrade.c  |  6 ++--
src/bin/pg_upgrade/pg_upgrade.h  |  2 ++
src/include/catalog/catversion.h |  2 +-
src/include/catalog/pg_proc.dat  | 14 
src/include/replication/slot.h   |  8 -
src/test/regress/expected/rules.out  |  5 +--
16 files changed, 141 insertions(+), 25 deletions(-)



pgsql: Fix comment on gist_stratnum_btree

2024-01-24 Thread Peter Eisentraut
Fix comment on gist_stratnum_btree

We give results for <, <=, =, >=, and >, not just =. Because why not?

Author: Paul A. Jungwirth 
Discussion: 
https://www.postgresql.org/message-id/flat/CA+renyUApHgSZF9-nd-a0+OPGharLQLO=mdhcy4_qq0+noc...@mail.gmail.com

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/86232a49a4373013056e8d38118339b8e7675ea0

Modified Files
--
contrib/btree_gist/btree_gist.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)



pgsql: jit: Require at least LLVM 10.

2024-01-24 Thread Thomas Munro
jit: Require at least LLVM 10.

Remove support for older LLVM versions.  The default on common software
distributions will be at least LLVM 10 when PostgreSQL 17 ships.

Reviewed-by: Peter Eisentraut 
Discussion: 
https://postgr.es/m/CA%2BhUKGLhNs5geZaVNj2EJ79Dx9W8fyWUU3HxcpZy55sMGcY%3DiA%40mail.gmail.com

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/820b5af73dcc6a5d0db6a98a62a6b859e5d107b6

Modified Files
--
config/llvm.m4  | 10 +++---
configure   | 43 +++
doc/src/sgml/installation.sgml  |  4 +--
meson.build |  2 +-
src/backend/jit/llvm/llvmjit.c  | 57 ++
src/backend/jit/llvm/llvmjit_error.cpp  | 10 --
src/backend/jit/llvm/llvmjit_expr.c |  6 +---
src/backend/jit/llvm/llvmjit_inline.cpp | 38 ++--
src/backend/jit/llvm/llvmjit_wrap.cpp   | 61 -
src/include/jit/llvmjit.h   | 17 -
src/include/pg_config.h.in  | 12 ---
11 files changed, 17 insertions(+), 243 deletions(-)



pgsql: Add progress reporting of skipped tuples during COPY FROM.

2024-01-24 Thread Masahiko Sawada
Add progress reporting of skipped tuples during COPY FROM.

9e2d870119 enabled the COPY command to skip malformed data, however
there was no visibility into how many tuples were actually skipped
during the COPY FROM.

This commit adds a new "tuples_skipped" column to
pg_stat_progress_copy view to report the number of tuples that were
skipped because they contain malformed data.

Bump catalog version.

Author: Atsushi Torikoshi
Reviewed-by: Masahiko Sawada
Discussion: 
https://postgr.es/m/d12fd8c99adcae2744212cb23feff6ed%40oss.nttdata.com

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/729439607ad210dbb446e31754e8627d7e3f7dda

Modified Files
--
doc/src/sgml/monitoring.sgml | 12 
src/backend/catalog/system_views.sql |  3 ++-
src/backend/commands/copyfrom.c  |  5 +
src/include/catalog/catversion.h |  2 +-
src/include/commands/progress.h  |  1 +
src/test/regress/expected/rules.out  |  3 ++-
6 files changed, 23 insertions(+), 3 deletions(-)



pgsql: Track LLVM 18 changes.

2024-01-24 Thread Thomas Munro
Track LLVM 18 changes.

A function was given a newly standard name from C++20 in LLVM 16.  Then
LLVM 18 added a deprecation warning for the old name, and it is about to
ship, so it's time to adjust that.

Back-patch to all supported releases.

Discussion: 
https://www.postgresql.org/message-id/CA+hUKGLbuVhH6mqS8z+FwAn4=5dhs0bawmemz3b+iyhwkc4...@mail.gmail.com

Branch
--
REL_12_STABLE

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

Modified Files
--
src/backend/jit/llvm/llvmjit_inline.cpp | 5 -
1 file changed, 4 insertions(+), 1 deletion(-)



pgsql: Track LLVM 18 changes.

2024-01-24 Thread Thomas Munro
Track LLVM 18 changes.

A function was given a newly standard name from C++20 in LLVM 16.  Then
LLVM 18 added a deprecation warning for the old name, and it is about to
ship, so it's time to adjust that.

Back-patch to all supported releases.

Discussion: 
https://www.postgresql.org/message-id/CA+hUKGLbuVhH6mqS8z+FwAn4=5dhs0bawmemz3b+iyhwkc4...@mail.gmail.com

Branch
--
REL_13_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/70a82f40ab4044b1fa690b0b97ec54b7a5e18647

Modified Files
--
src/backend/jit/llvm/llvmjit_inline.cpp | 5 -
1 file changed, 4 insertions(+), 1 deletion(-)



pgsql: Track LLVM 18 changes.

2024-01-24 Thread Thomas Munro
Track LLVM 18 changes.

A function was given a newly standard name from C++20 in LLVM 16.  Then
LLVM 18 added a deprecation warning for the old name, and it is about to
ship, so it's time to adjust that.

Back-patch to all supported releases.

Discussion: 
https://www.postgresql.org/message-id/CA+hUKGLbuVhH6mqS8z+FwAn4=5dhs0bawmemz3b+iyhwkc4...@mail.gmail.com

Branch
--
REL_14_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/364283c92e4a4183fb4f80ce4ec9ba96007b6632

Modified Files
--
src/backend/jit/llvm/llvmjit_inline.cpp | 5 -
1 file changed, 4 insertions(+), 1 deletion(-)



pgsql: Track LLVM 18 changes.

2024-01-24 Thread Thomas Munro
Track LLVM 18 changes.

A function was given a newly standard name from C++20 in LLVM 16.  Then
LLVM 18 added a deprecation warning for the old name, and it is about to
ship, so it's time to adjust that.

Back-patch to all supported releases.

Discussion: 
https://www.postgresql.org/message-id/CA+hUKGLbuVhH6mqS8z+FwAn4=5dhs0bawmemz3b+iyhwkc4...@mail.gmail.com

Branch
--
REL_15_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/67f7aaa38172155ab2d8a2248e87b5d0b7dc6444

Modified Files
--
src/backend/jit/llvm/llvmjit_inline.cpp | 5 -
1 file changed, 4 insertions(+), 1 deletion(-)



pgsql: Track LLVM 18 changes.

2024-01-24 Thread Thomas Munro
Track LLVM 18 changes.

A function was given a newly standard name from C++20 in LLVM 16.  Then
LLVM 18 added a deprecation warning for the old name, and it is about to
ship, so it's time to adjust that.

Back-patch to all supported releases.

Discussion: 
https://www.postgresql.org/message-id/CA+hUKGLbuVhH6mqS8z+FwAn4=5dhs0bawmemz3b+iyhwkc4...@mail.gmail.com

Branch
--
REL_16_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/60ba7cae7cc758f09899429d1134a14adc35fd94

Modified Files
--
src/backend/jit/llvm/llvmjit_inline.cpp | 5 -
1 file changed, 4 insertions(+), 1 deletion(-)



pgsql: Track LLVM 18 changes.

2024-01-24 Thread Thomas Munro
Track LLVM 18 changes.

A function was given a newly standard name from C++20 in LLVM 16.  Then
LLVM 18 added a deprecation warning for the old name, and it is about to
ship, so it's time to adjust that.

Back-patch to all supported releases.

Discussion: 
https://www.postgresql.org/message-id/CA+hUKGLbuVhH6mqS8z+FwAn4=5dhs0bawmemz3b+iyhwkc4...@mail.gmail.com

Branch
--
master

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

Modified Files
--
src/backend/jit/llvm/llvmjit_inline.cpp | 5 -
1 file changed, 4 insertions(+), 1 deletion(-)



pgsql: Rename index "abc" in aggregates.sql

2024-01-24 Thread Alexander Korotkov
Rename index "abc" in aggregates.sql

In order to prevent name collision with table "abc" in namespace.sql.

Reported-by: Nathan Bossart
Discussion: https://postgr.es/m/20240124173735.GA2708416%40nathanxps13

Branch
--
master

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

Modified Files
--
src/test/regress/expected/aggregates.out | 56 
src/test/regress/sql/aggregates.sql  |  2 +-
2 files changed, 29 insertions(+), 29 deletions(-)



pgsql: Add temporal PRIMARY KEY and UNIQUE constraints

2024-01-24 Thread Peter Eisentraut
Add temporal PRIMARY KEY and UNIQUE constraints

Add WITHOUT OVERLAPS clause to PRIMARY KEY and UNIQUE constraints.
These are backed by GiST indexes instead of B-tree indexes, since they
are essentially exclusion constraints with = for the scalar parts of
the key and && for the temporal part.

Author: Paul A. Jungwirth 
Reviewed-by: Peter Eisentraut 
Reviewed-by: jian he 
Discussion: 
https://www.postgresql.org/message-id/flat/CA+renyUApHgSZF9-nd-a0+OPGharLQLO=mdhcy4_qq0+noc...@mail.gmail.com

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/46a0cd4cefb4d9b462d8cc4df5e7ecdd190bea92

Modified Files
--
contrib/btree_gist/Makefile  |   2 +-
contrib/btree_gist/expected/without_overlaps.out |  44 +++
contrib/btree_gist/meson.build   |   1 +
contrib/btree_gist/sql/without_overlaps.sql  |  25 ++
doc/src/sgml/catalogs.sgml   |  10 +
doc/src/sgml/gist.sgml   |  14 +-
doc/src/sgml/ref/create_table.sgml   |  45 ++-
src/backend/access/gist/gistutil.c   |  29 ++
src/backend/catalog/heap.c   |   2 +
src/backend/catalog/index.c  |   4 +
src/backend/catalog/pg_constraint.c  |   2 +
src/backend/commands/indexcmds.c | 143 +++-
src/backend/commands/tablecmds.c |   6 +-
src/backend/commands/trigger.c   |   1 +
src/backend/commands/typecmds.c  |   1 +
src/backend/nodes/outfuncs.c |   2 +
src/backend/nodes/readfuncs.c|   2 +
src/backend/parser/gram.y|  29 +-
src/backend/parser/parse_utilcmd.c   |  28 +-
src/backend/utils/adt/ruleutils.c|   2 +
src/backend/utils/cache/relcache.c   |  18 +-
src/bin/pg_dump/pg_dump.c|  16 +-
src/bin/pg_dump/pg_dump.h|   2 +
src/bin/pg_dump/t/002_pg_dump.pl |  36 +++
src/bin/psql/describe.c  |  12 +-
src/include/access/gist.h|   3 +
src/include/catalog/catversion.h |   2 +-
src/include/catalog/index.h  |   1 +
src/include/catalog/pg_constraint.h  |  10 +-
src/include/commands/defrem.h|   6 +-
src/include/nodes/parsenodes.h   |   2 +
src/test/regress/expected/without_overlaps.out   | 395 +++
src/test/regress/parallel_schedule   |   2 +-
src/test/regress/sql/without_overlaps.sql| 290 +
34 files changed, 1135 insertions(+), 52 deletions(-)



pgsql: Improve notation of BuiltinTrancheNames

2024-01-24 Thread Alvaro Herrera
Improve notation of BuiltinTrancheNames

Use C99 designated initializer syntax for array elements, instead of
writing the position in a comment.  This is less verbose and much more
readable.  Akin to cc150596341e.

One disadvantage is that the BuiltinTrancheNames array now has a hole of
51 NULLs -- previously, the array elements were shifted 51 elements
 downward to avoid this.  This can be fixed by merging the
IndividualLWLockNames array into BuiltinTrancheNames, which would occupy
those 51 pointers, but because it requires some arguably ugly Meson
hackery, it's left for later.

Discussion: https://postgr.es/m/202401231025.gbv4nnte5fmm@alvherre.pgsql

Branch
--
master

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

Modified Files
--
src/backend/storage/lmgr/lwlock.c | 97 +--
1 file changed, 33 insertions(+), 64 deletions(-)