pgsql: Doc: document cases where queryid is stable

2024-04-19 Thread David Rowley
Doc: document cases where queryid is stable

The documents were clear that queryid should not be assumed to be stable
between major versions but said nothing about minor versions and left
the reader to guess if that was implied by the mention of the
instability of queryid between major versions.

Here we give minor versions an explicit mention to indicate queryid can
generally be assumed stable between minor versions.

Reviewed-by: Michael Paquier
Discussion: 
https://postgr.es/m/CAApHDvpYGE6h0cD9UO-eHySPynPj1L3J%3DHxT%2BA7Ud8_Yo6AuzA%40mail.gmail.com
Backpatch-through: 12

Branch
--
REL_12_STABLE

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

Modified Files
--
doc/src/sgml/pgstatstatements.sgml | 24 +++-
1 file changed, 15 insertions(+), 9 deletions(-)



pgsql: Doc: document cases where queryid is stable

2024-04-19 Thread David Rowley
Doc: document cases where queryid is stable

The documents were clear that queryid should not be assumed to be stable
between major versions but said nothing about minor versions and left
the reader to guess if that was implied by the mention of the
instability of queryid between major versions.

Here we give minor versions an explicit mention to indicate queryid can
generally be assumed stable between minor versions.

Reviewed-by: Michael Paquier
Discussion: 
https://postgr.es/m/CAApHDvpYGE6h0cD9UO-eHySPynPj1L3J%3DHxT%2BA7Ud8_Yo6AuzA%40mail.gmail.com
Backpatch-through: 12

Branch
--
REL_13_STABLE

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

Modified Files
--
doc/src/sgml/pgstatstatements.sgml | 24 +++-
1 file changed, 15 insertions(+), 9 deletions(-)



pgsql: Doc: document cases where queryid is stable

2024-04-19 Thread David Rowley
Doc: document cases where queryid is stable

The documents were clear that queryid should not be assumed to be stable
between major versions but said nothing about minor versions and left
the reader to guess if that was implied by the mention of the
instability of queryid between major versions.

Here we give minor versions an explicit mention to indicate queryid can
generally be assumed stable between minor versions.

Reviewed-by: Michael Paquier
Discussion: 
https://postgr.es/m/CAApHDvpYGE6h0cD9UO-eHySPynPj1L3J%3DHxT%2BA7Ud8_Yo6AuzA%40mail.gmail.com
Backpatch-through: 12

Branch
--
REL_14_STABLE

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

Modified Files
--
doc/src/sgml/pgstatstatements.sgml | 24 +++-
1 file changed, 15 insertions(+), 9 deletions(-)



pgsql: Doc: document cases where queryid is stable

2024-04-19 Thread David Rowley
Doc: document cases where queryid is stable

The documents were clear that queryid should not be assumed to be stable
between major versions but said nothing about minor versions and left
the reader to guess if that was implied by the mention of the
instability of queryid between major versions.

Here we give minor versions an explicit mention to indicate queryid can
generally be assumed stable between minor versions.

Reviewed-by: Michael Paquier
Discussion: 
https://postgr.es/m/CAApHDvpYGE6h0cD9UO-eHySPynPj1L3J%3DHxT%2BA7Ud8_Yo6AuzA%40mail.gmail.com
Backpatch-through: 12

Branch
--
REL_15_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/38daca854adbc2980393daab160a2d657bd010d6

Modified Files
--
doc/src/sgml/pgstatstatements.sgml | 24 +++-
1 file changed, 15 insertions(+), 9 deletions(-)



pgsql: Doc: document cases where queryid is stable

2024-04-19 Thread David Rowley
Doc: document cases where queryid is stable

The documents were clear that queryid should not be assumed to be stable
between major versions but said nothing about minor versions and left
the reader to guess if that was implied by the mention of the
instability of queryid between major versions.

Here we give minor versions an explicit mention to indicate queryid can
generally be assumed stable between minor versions.

Reviewed-by: Michael Paquier
Discussion: 
https://postgr.es/m/CAApHDvpYGE6h0cD9UO-eHySPynPj1L3J%3DHxT%2BA7Ud8_Yo6AuzA%40mail.gmail.com
Backpatch-through: 12

Branch
--
REL_16_STABLE

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

Modified Files
--
doc/src/sgml/pgstatstatements.sgml | 24 +++-
1 file changed, 15 insertions(+), 9 deletions(-)



pgsql: Doc: document cases where queryid is stable

2024-04-19 Thread David Rowley
Doc: document cases where queryid is stable

The documents were clear that queryid should not be assumed to be stable
between major versions but said nothing about minor versions and left
the reader to guess if that was implied by the mention of the
instability of queryid between major versions.

Here we give minor versions an explicit mention to indicate queryid can
generally be assumed stable between minor versions.

Reviewed-by: Michael Paquier
Discussion: 
https://postgr.es/m/CAApHDvpYGE6h0cD9UO-eHySPynPj1L3J%3DHxT%2BA7Ud8_Yo6AuzA%40mail.gmail.com
Backpatch-through: 12

Branch
--
master

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

Modified Files
--
doc/src/sgml/pgstatstatements.sgml | 24 +++-
1 file changed, 15 insertions(+), 9 deletions(-)



pgsql: Revert recent ill-advised test case changes.

2024-04-19 Thread Robert Haas
Revert recent ill-advised test case changes.

Commit 6bf5c42b5546984df29289918f952e6211069c54 cannot work on Windows,
because it lacks symlink support. While the bug fix in commit
cd64dc42d1e1b03e57e6ba3d316e4f9dec52a78d is correct as far as I know,
the test case changes depend on the previous commit, so this will
have to live without test coverage until we can come up with a better
solution. Commit fa7036dd6644d13233b475874a94754a5903e35a was a test
case bug fix on top of those two, to prevent failures on Linux, so that
has to come out as well.

Per the buildfarm, CI, and Thomas Munro.

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/82023d47de9e262730b1f9b4ea77fae201a89d0a

Modified Files
--
src/bin/pg_basebackup/t/010_pg_basebackup.pl  | 21 -
src/bin/pg_combinebackup/t/002_compare_backups.pl | 32 +---
src/test/perl/PostgreSQL/Test/Cluster.pm  | 93 ++-
3 files changed, 28 insertions(+), 118 deletions(-)



pgsql: Use tempdir_short instead of tempdir.

2024-04-19 Thread Robert Haas
Use tempdir_short instead of tempdir.

After cd64dc42d1e1b03e57e6ba3d316e4f9dec52a78d, a significant
percentage of the buildfarm got unhappy, because pg_basebackup chokes
if it tries to create a tarfile with symlink more than 99 characters
in length. To try to fix that problem, use tempdir_short instead of
tempdir, as we do in pg_verifybackup's 003_corruption.pl.

There's a more complicated workaround for the same issue in
pg_basebackup's 010_pg_basebackup.pl, but I'm not clear whether
there's any reason to do it that way here. For now, let's try this,
to at least get the buildfarm green again.

A better long-term fix would be to figure out how to generate tar
files containing long symlinks, but that will have to wait for
another time.

Branch
--
master

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

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



pgsql: pg_combinebackup: Fix incorrect tablespace handling.

2024-04-19 Thread Robert Haas
pg_combinebackup: Fix incorrect tablespace handling.

The previous coding mangled the pathname calculation for
incremental files located in user-defined tablespaces.

Enhance the test cases to cover such cases, as I should have
done originally. Thanks to Andres Freund for alerting me to the
lack of test coverage.

Discussion: 
http://postgr.es/m/ca+tgmoydxtjo9iqeoiptccdpwzzvbns6endy2uarm+t4yg_...@mail.gmail.com

Branch
--
master

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

Modified Files
--
src/bin/pg_combinebackup/pg_combinebackup.c   |  2 +-
src/bin/pg_combinebackup/reconstruct.c|  7 ++---
src/bin/pg_combinebackup/t/002_compare_backups.pl | 32 ---
3 files changed, 33 insertions(+), 8 deletions(-)



pgsql: Make PostgreSQL::Test::Cluster::init_from_backup handle tablespa

2024-04-19 Thread Robert Haas
Make PostgreSQL::Test::Cluster::init_from_backup handle tablespaces.

This commit doesn't use this infrastructure for anything new, although
it does adapt 010_pg_basebackup.pl to use it. However, a future commit
will use this to improve test coverage for pg_combinebackup.

Patch by me, reviewed (but not fully endorsed) by Andres Freund.

Discussion: 
http://postgr.es/m/ca+tgmoydxtjo9iqeoiptccdpwzzvbns6endy2uarm+t4yg_...@mail.gmail.com

Branch
--
master

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

Modified Files
--
src/bin/pg_basebackup/t/010_pg_basebackup.pl | 21 ++-
src/test/perl/PostgreSQL/Test/Cluster.pm | 93 +---
2 files changed, 90 insertions(+), 24 deletions(-)



pgsql: Fix a couple typos in BRIN code

2024-04-19 Thread Tomas Vondra
Fix a couple typos in BRIN code

Typos introduced by commits c1ec02be1d79, b43757171470 and dae761a87eda.

Author: Alvaro Herrera
Reported-by: Alexander Lakhin
Discussion: https://postgr.es/m/202401091043.e3nrqiad6gb7@alvherre.pgsql

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/95d14b7ae26db5ed85d9945e29121bb0e9b59863

Modified Files
--
doc/src/sgml/indexam.sgml  |  2 +-
src/backend/access/brin/brin.c | 10 +-
2 files changed, 6 insertions(+), 6 deletions(-)



pgsql: Add missing index_insert_cleanup calls

2024-04-19 Thread Tomas Vondra
Add missing index_insert_cleanup calls

The optimization for inserts into BRIN indexes added by c1ec02be1d79
relies on a cache that needs to be explicitly released after calling
index_insert(). The commit however failed to invoke the cleanup in
validate_index(), which calls index_insert() indirectly through
table_index_validate_scan().

After inspecting index_insert() callers, it seems unique_key_recheck()
is missing the call too.

Fixed by adding the two missing index_insert_cleanup() calls.

The commit does two additional improvements. The aminsertcleanup()
signature is modified to have the index as the first argument, to make
it more like the other AM callbacks. And the aminsertcleanup() callback
is invoked even if the ii_AmCache is NULL, so that it can decide if the
cleanup is necessary.

Author: Alvaro Herrera, Tomas Vondra
Reported-by: Alexander Lakhin
Discussion: https://postgr.es/m/202401091043.e3nrqiad6gb7@alvherre.pgsql

Branch
--
master

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

Modified Files
--
doc/src/sgml/indexam.sgml  | 14 +++---
src/backend/access/brin/brin.c |  6 --
src/backend/access/index/indexam.c |  5 ++---
src/backend/catalog/index.c|  3 +++
src/backend/commands/constraint.c  |  3 +++
src/include/access/amapi.h |  3 ++-
src/include/access/brin_internal.h |  2 +-
src/test/regress/expected/brin.out |  3 ++-
src/test/regress/sql/brin.sql  |  3 ++-
9 files changed, 26 insertions(+), 16 deletions(-)



pgsql: Doc: Remove mention of @ and ~ GiST operators

2024-04-19 Thread Daniel Gustafsson
Doc: Remove mention of @ and ~ GiST operators

These operators were removed by 2f70fdb0644c in the v14 cycle but they were
accidentally left in the table of build-in operator classes. Backpatch down
to v14 where the operators where removed.

Author: Aleksander Alekseev 
Reported-by: Colin Caine 
Discussion: 
https://postgr.es/m/CADwQTQbbr2UQ_fpbyc+8ay=RwEYgYk=tzxh3+rhdqaqfog+...@mail.gmail.com
Backpatch-through: v14

Branch
--
REL_14_STABLE

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

Modified Files
--
doc/src/sgml/gist.sgml | 18 ++
1 file changed, 6 insertions(+), 12 deletions(-)



pgsql: Doc: Remove mention of @ and ~ GiST operators

2024-04-19 Thread Daniel Gustafsson
Doc: Remove mention of @ and ~ GiST operators

These operators were removed by 2f70fdb0644c in the v14 cycle but they were
accidentally left in the table of build-in operator classes. Backpatch down
to v14 where the operators where removed.

Author: Aleksander Alekseev 
Reported-by: Colin Caine 
Discussion: 
https://postgr.es/m/CADwQTQbbr2UQ_fpbyc+8ay=RwEYgYk=tzxh3+rhdqaqfog+...@mail.gmail.com
Backpatch-through: v14

Branch
--
REL_15_STABLE

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

Modified Files
--
doc/src/sgml/gist.sgml | 18 ++
1 file changed, 6 insertions(+), 12 deletions(-)



pgsql: Doc: Remove mention of @ and ~ GiST operators

2024-04-19 Thread Daniel Gustafsson
Doc: Remove mention of @ and ~ GiST operators

These operators were removed by 2f70fdb0644c in the v14 cycle but they were
accidentally left in the table of build-in operator classes. Backpatch down
to v14 where the operators where removed.

Author: Aleksander Alekseev 
Reported-by: Colin Caine 
Discussion: 
https://postgr.es/m/CADwQTQbbr2UQ_fpbyc+8ay=RwEYgYk=tzxh3+rhdqaqfog+...@mail.gmail.com
Backpatch-through: v14

Branch
--
master

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

Modified Files
--
doc/src/sgml/gist.sgml | 18 ++
1 file changed, 6 insertions(+), 12 deletions(-)



pgsql: Doc: Remove mention of @ and ~ GiST operators

2024-04-19 Thread Daniel Gustafsson
Doc: Remove mention of @ and ~ GiST operators

These operators were removed by 2f70fdb0644c in the v14 cycle but they were
accidentally left in the table of build-in operator classes. Backpatch down
to v14 where the operators where removed.

Author: Aleksander Alekseev 
Reported-by: Colin Caine 
Discussion: 
https://postgr.es/m/CADwQTQbbr2UQ_fpbyc+8ay=RwEYgYk=tzxh3+rhdqaqfog+...@mail.gmail.com
Backpatch-through: v14

Branch
--
REL_16_STABLE

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

Modified Files
--
doc/src/sgml/gist.sgml | 18 ++
1 file changed, 6 insertions(+), 12 deletions(-)



pgsql: Better handle indirect constraint drops

2024-04-19 Thread Alvaro Herrera
Better handle indirect constraint drops

It is possible for certain cases to remove not-null constraints without
maintaining the attnotnull in its correct state; for example if you drop
a column that's part of the primary key, and the other columns of the PK don't
have not-null constraints, then we should reset the attnotnull flags for
those other columns; up to this commit, we didn't.  Handle those cases
better by doing the attnotnull reset in RemoveConstraintById() instead
of in dropconstraint_internal().

However, there are some cases where we must not do so.  For example if
those other columns are in replica identity indexes or are generated
identity columns, we must keep attnotnull set, even though it results in
the catalog inconsistency that no not-null constraint supports that.

Because the attnotnull reset now happens in more places than before, for
instance when a column of the primary key changes type, we need an
additional trick to reinstate it as necessary.  Introduce a new
alter-table pass that does this, which needs simply reschedule some
AT_SetAttNotNull subcommands that were already being generated and
ignored.

Because of the exceptions in which attnotnull is not reset noted above,
we also include a pg_dump hack to include a not-null constraint when the
attnotnull flag is set even if no pg_constraint row exists.  This part
is undesirable but necessary, because failing to handle the case can
result in unrestorable dumps.

Reported-by: Tender Wang 
Co-authored-by: Tender Wang 
Reviewed-by: jian he 
Discussion: 
https://postgr.es/m/CAHewXN=hMbNa3d43NOR=ocgdgptt18s-1fmuecoegesyek4...@mail.gmail.com

Branch
--
master

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

Modified Files
--
src/backend/catalog/pg_constraint.c   | 117 +-
src/backend/commands/tablecmds.c  | 135 +++---
src/bin/pg_dump/pg_dump.c |  30 +--
src/test/regress/expected/constraints.out |  78 +
src/test/regress/sql/constraints.sql  |  39 +
5 files changed, 323 insertions(+), 76 deletions(-)



pgsql: Use macro NUM_MERGE_MATCH_KINDS instead of '3' in MERGE code.

2024-04-19 Thread Dean Rasheed
Use macro NUM_MERGE_MATCH_KINDS instead of '3' in MERGE code.

Code quality improvement for 0294df2f1f84.

Aleksander Alekseev, reviewed by Richard Guo.

Discussion: 
https://postgr.es/m/CAJ7c6TMsiaV5urU_Pq6zJ2tXPDwk69-NKVh4AMN5XrRiM7N%2BGA%40mail.gmail.com

Branch
--
master

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

Modified Files
--
src/backend/optimizer/prep/prepjointree.c | 2 +-
src/backend/parser/parse_merge.c  | 2 +-
src/include/nodes/execnodes.h | 2 +-
src/include/nodes/primnodes.h | 2 ++
4 files changed, 5 insertions(+), 3 deletions(-)



pgsql: Remove unused function prototype

2024-04-19 Thread Daniel Gustafsson
Remove unused function prototype

Commit aafc05de1bf5 removed StartSlotSyncWorker() but mistakenly left
the prototype in slotsync.h.  Fix by removing.

Reported-by: Alexander Lakhin 
Discussion: https://postgr.es/m/3f577953-a29e-4722-98ad-2da9eff2c...@yesql.se

Branch
--
master

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

Modified Files
--
src/include/replication/slotsync.h | 1 -
1 file changed, 1 deletion(-)



pgsql: Fix incorrect parameter name in prototype

2024-04-19 Thread Daniel Gustafsson
Fix incorrect parameter name in prototype

The function declaration for select_next_encryption_method use the
variable name have_valid_connection, so fix the prototype in the
header to match that.

Reported-by: Alexander Lakhin 
Discussion: https://postgr.es/m/3f577953-a29e-4722-98ad-2da9eff2c...@yesql.se

Branch
--
master

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

Modified Files
--
src/interfaces/libpq/fe-connect.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)