pgsql: Fix a leftover reference to backend_id in comment

2024-03-04 Thread Heikki Linnakangas
Fix a leftover reference to backend_id in comment

Commit 024c521117 replaced backend_id with proc_number.

Reported-by: Alexander Lakhin

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/55cdba2647ed6bbe1126c6b6d8f53e8602ec05a1

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



pgsql: Fix buildfarm failures from 2af07e2f74.

2024-03-04 Thread Jeff Davis
Fix buildfarm failures from 2af07e2f74.

Use GUC_ACTION_SAVE rather than GUC_ACTION_SET, necessary for working
with parallel query.

Now that the call requires more arguments, wrap the call in a new
function to avoid code duplication and offer a place for a comment.

Discussion: https://postgr.es/m/e1rhjpo-0027wf...@gemulon.postgresql.org

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/59825d16399699e2f99016b9add46cb2d4916f82

Modified Files
--
contrib/amcheck/t/004_verify_nbtree_unique.pl | 45 +++
contrib/amcheck/verify_nbtree.c   |  3 +-
src/backend/access/brin/brin.c|  3 +-
src/backend/catalog/index.c   | 13 +++-
src/backend/commands/analyze.c|  3 +-
src/backend/commands/cluster.c|  3 +-
src/backend/commands/indexcmds.c  | 10 ++
src/backend/commands/matview.c|  3 +-
src/backend/commands/vacuum.c |  3 +-
src/backend/utils/misc/guc.c  | 19 +++
src/include/utils/guc.h   |  7 +
11 files changed, 52 insertions(+), 60 deletions(-)



pgsql: Fix incorrectly reported stats kind in "can't happen" ERROR

2024-03-04 Thread David Rowley
Fix incorrectly reported stats kind in "can't happen" ERROR

The error message(s) were reporting the stats kind of 'f', which is not
correct as that's for the "dependencies" statistics kind.

Reported-by: Horst Reiterer
Reviewed-by: Richard Guo
Discussion: https://postgr.es/m/18375-ba99383eb9062...@postgresql.org
Backpatch-through: 12, where MCV extended stats were added.

Branch
--
REL_12_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/94246405d5d7cb90fc2eff12d9c42b38070fb970

Modified Files
--
src/backend/statistics/mcv.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)



pgsql: Fix incorrectly reported stats kind in "can't happen" ERROR

2024-03-04 Thread David Rowley
Fix incorrectly reported stats kind in "can't happen" ERROR

The error message(s) were reporting the stats kind of 'f', which is not
correct as that's for the "dependencies" statistics kind.

Reported-by: Horst Reiterer
Reviewed-by: Richard Guo
Discussion: https://postgr.es/m/18375-ba99383eb9062...@postgresql.org
Backpatch-through: 12, where MCV extended stats were added.

Branch
--
REL_13_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/421dfb41a843a60c8cf4468e8c2328a24f390a90

Modified Files
--
src/backend/statistics/mcv.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)



pgsql: Fix incorrectly reported stats kind in "can't happen" ERROR

2024-03-04 Thread David Rowley
Fix incorrectly reported stats kind in "can't happen" ERROR

The error message(s) were reporting the stats kind of 'f', which is not
correct as that's for the "dependencies" statistics kind.

Reported-by: Horst Reiterer
Reviewed-by: Richard Guo
Discussion: https://postgr.es/m/18375-ba99383eb9062...@postgresql.org
Backpatch-through: 12, where MCV extended stats were added.

Branch
--
REL_14_STABLE

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

Modified Files
--
src/backend/statistics/extended_stats.c | 2 +-
src/backend/statistics/mcv.c| 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)



pgsql: Fix incorrectly reported stats kind in "can't happen" ERROR

2024-03-04 Thread David Rowley
Fix incorrectly reported stats kind in "can't happen" ERROR

The error message(s) were reporting the stats kind of 'f', which is not
correct as that's for the "dependencies" statistics kind.

Reported-by: Horst Reiterer
Reviewed-by: Richard Guo
Discussion: https://postgr.es/m/18375-ba99383eb9062...@postgresql.org
Backpatch-through: 12, where MCV extended stats were added.

Branch
--
REL_15_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/164fe7a6e1f34a56d91c0130daddbbe6a8e8392f

Modified Files
--
src/backend/statistics/extended_stats.c | 2 +-
src/backend/statistics/mcv.c| 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)



pgsql: Fix incorrectly reported stats kind in "can't happen" ERROR

2024-03-04 Thread David Rowley
Fix incorrectly reported stats kind in "can't happen" ERROR

The error message(s) were reporting the stats kind of 'f', which is not
correct as that's for the "dependencies" statistics kind.

Reported-by: Horst Reiterer
Reviewed-by: Richard Guo
Discussion: https://postgr.es/m/18375-ba99383eb9062...@postgresql.org
Backpatch-through: 12, where MCV extended stats were added.

Branch
--
REL_16_STABLE

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

Modified Files
--
src/backend/statistics/extended_stats.c | 2 +-
src/backend/statistics/mcv.c| 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)



pgsql: Fix incorrectly reported stats kind in "can't happen" ERROR

2024-03-04 Thread David Rowley
Fix incorrectly reported stats kind in "can't happen" ERROR

The error message(s) were reporting the stats kind of 'f', which is not
correct as that's for the "dependencies" statistics kind.

Reported-by: Horst Reiterer
Reviewed-by: Richard Guo
Discussion: https://postgr.es/m/18375-ba99383eb9062...@postgresql.org
Backpatch-through: 12, where MCV extended stats were added.

Branch
--
master

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

Modified Files
--
src/backend/statistics/extended_stats.c | 2 +-
src/backend/statistics/mcv.c| 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)



Re: pgsql: Fix search_path to a safe value during maintenance operations.

2024-03-04 Thread Jeff Davis
On Mon, 2024-03-04 at 21:15 -0500, Tom Lane wrote:
> Jeff Davis  writes:
> > Fix search_path to a safe value during maintenance operations.
> 
> The buildfarm seems pretty unhappy with this.

Looks like I need to use GUC_ACTION_SAVE. I will remedy it shortly.

Regards,
Jeff Davis





Re: pgsql: Fix search_path to a safe value during maintenance operations.

2024-03-04 Thread Tom Lane
Jeff Davis  writes:
> Fix search_path to a safe value during maintenance operations.

The buildfarm seems pretty unhappy with this.

regards, tom lane




pgsql: Fix search_path to a safe value during maintenance operations.

2024-03-04 Thread Jeff Davis
Fix search_path to a safe value during maintenance operations.

While executing maintenance operations (ANALYZE, CLUSTER, REFRESH
MATERIALIZED VIEW, REINDEX, or VACUUM), set search_path to
'pg_catalog, pg_temp' to prevent inconsistent behavior.

Functions that are used for functional indexes, in index expressions,
or in materialized views and depend on a different search path must be
declared with CREATE FUNCTION ... SET search_path='...'.

This change was previously committed as 05e1737351, then reverted in
commit 2fcc7ee7af because it was too late in the cycle.

Preparation for the MAINTAIN privilege, which was previously reverted
due to search_path manipulation hazards.

Discussion: 
https://postgr.es/m/d4ccaf3658cb3c281ec88c851a09733cd9482f22.ca...@j-davis.com
Discussion: https://postgr.es/m/E1q7j7Y-000z1H-Hr%40gemulon.postgresql.org
Discussion: 
https://postgr.es/m/e44327179e5c9015c8dda67351c04da552066017.camel%40j-davis.com
Reviewed-by: Greg Stark, Nathan Bossart, Noah Misch

Branch
--
master

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

Modified Files
--
contrib/amcheck/t/004_verify_nbtree_unique.pl  | 33 +---
contrib/amcheck/verify_nbtree.c|  2 +
doc/src/sgml/amcheck.sgml  |  3 ++
doc/src/sgml/brin.sgml |  4 +-
doc/src/sgml/ref/analyze.sgml  |  6 +++
doc/src/sgml/ref/cluster.sgml  |  6 +++
doc/src/sgml/ref/create_index.sgml |  6 +++
doc/src/sgml/ref/refresh_materialized_view.sgml|  6 +++
doc/src/sgml/ref/reindex.sgml  |  6 +++
doc/src/sgml/ref/vacuum.sgml   |  6 +++
src/backend/access/brin/brin.c |  2 +
src/backend/catalog/index.c|  9 +
src/backend/catalog/namespace.c|  3 ++
src/backend/commands/analyze.c |  2 +
src/backend/commands/cluster.c |  2 +
src/backend/commands/indexcmds.c   |  8 
src/backend/commands/matview.c |  2 +
src/backend/commands/vacuum.c  |  2 +
src/bin/scripts/t/100_vacuumdb.pl  |  4 --
src/include/utils/guc.h|  6 +++
.../test_oat_hooks/expected/alter_table.out|  2 +
.../test_oat_hooks/expected/test_oat_hooks.out |  4 ++
src/test/regress/expected/matview.out  |  4 +-
src/test/regress/expected/namespace.out| 44 ++
src/test/regress/expected/privileges.out   | 12 +++---
src/test/regress/expected/vacuum.out   |  2 +-
src/test/regress/sql/matview.sql   |  4 +-
src/test/regress/sql/namespace.sql | 32 
src/test/regress/sql/privileges.sql|  8 ++--
src/test/regress/sql/vacuum.sql|  2 +-
30 files changed, 200 insertions(+), 32 deletions(-)



pgsql: Add macro for customizing an archiving WARNING message.

2024-03-04 Thread Nathan Bossart
Add macro for customizing an archiving WARNING message.

Presently, if an archive module's check_configured_cb callback
returns false, a generic WARNING message is emitted, which
unfortunately provides no actionable details about the reason why
the module is not configured.  This commit introduces a macro that
archive module authors can use to add a DETAIL line to this WARNING
message.

Co-authored-by: Tung Nguyen
Reviewed-by: Daniel Gustafsson, Álvaro Herrera
Discussion: 
https://postgr.es/m/4109578306242a7cd5661171647e11b2%40oss.nttdata.com

Branch
--
master

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

Modified Files
--
contrib/basic_archive/basic_archive.c |  7 ++-
doc/src/sgml/archive-modules.sgml | 12 
src/backend/archive/shell_archive.c   |  7 ++-
src/backend/postmaster/pgarch.c   |  8 +++-
src/include/archive/archive_module.h  |  8 
5 files changed, 39 insertions(+), 3 deletions(-)



pgsql: Explicitly list dependent types as extension members in pg_depen

2024-03-04 Thread Tom Lane
Explicitly list dependent types as extension members in pg_depend.

Auto-generated array types, multirange types, and relation rowtypes
are treated as dependent objects: they can't be dropped separately
from the base object, nor can they have their own ownership or
permissions.  We previously felt that, for objects that are in an
extension, only the base object needs to be listed as an extension
member in pg_depend.  While that's sufficient to prevent inappropriate
drops, it results in undesirable answers if someone asks whether a
dependent type belongs to the extension.  It looks like the dependent
type is just some random separately-created object that happens to
depend on the base object.  Notably, this results in postgres_fdw
concluding that expressions involving an array type are not shippable
to the remote server, even when the defining extension has been
whitelisted.

To fix, cause GenerateTypeDependencies to make extension dependencies
for dependent types as well as their base objects, and adjust
ExecAlterExtensionContentsStmt so that object addition and removal
operations recurse to dependent types.  The latter change means that
pg_upgrade of a type-defining extension will end with the dependent
type(s) now also listed as extension members, even if they were
not that way in the source database.  Normally we want pg_upgrade
to precisely reproduce the source extension's state, but it seems
desirable to make an exception here.

This is arguably a bug fix, but we can't back-patch it since it
causes changes in the expected contents of pg_depend.  (Because
it does, I've bumped catversion, even though there's no change
in the immediate post-initdb catalog contents.)

Tom Lane and David Geier

Discussion: https://postgr.es/m/4a847c55-489f-4e8d-a664-fc6b1cbe3...@gmail.com

Branch
--
master

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

Modified Files
--
src/backend/catalog/pg_type.c  |  17 ++-
src/backend/commands/extension.c   |  83 +--
src/include/catalog/catversion.h   |   2 +-
src/test/modules/test_extensions/Makefile  |   3 +-
.../test_extensions/expected/test_extensions.out   | 159 +++--
src/test/modules/test_extensions/meson.build   |   2 +
.../test_extensions/sql/test_extensions.sql|  13 ++
.../modules/test_extensions/test_ext9--1.0.sql |   8 ++
src/test/modules/test_extensions/test_ext9.control |   3 +
9 files changed, 265 insertions(+), 25 deletions(-)



pgsql: pg_verifybackup: Refactor parse_manifest_file.

2024-03-04 Thread Robert Haas
pg_verifybackup: Refactor parse_manifest_file.

Return a pointer to the manifest_data instead of individual pointers
to relevant data stored within the manifest_data object. The previous
approach scales poorly if we add more things to the backup manifest,
as has been proposed.

Amul Sul, reviewed by Sravan Velagandula, Michael Paquier, and me.

Discussion: 
http://postgr.es/m/CAAJ_b95=1lonf99-m_ep588fl_wgljfdnb7xg4gwe7jdd22...@mail.gmail.com

Branch
--
master

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

Modified Files
--
src/bin/pg_verifybackup/pg_verifybackup.c | 75 ++-
1 file changed, 34 insertions(+), 41 deletions(-)



Re: pgsql: Remove the adminpack contrib extension

2024-03-04 Thread Tom Lane
Daniel Gustafsson  writes:
> The deviation between database names on crake found in the follow-up commit is
> a bit concerning.  Too much magic hidden away from the codetree makes it hard
> to get tests right on the first try.

Yeah, I didn't understand that at all.  I have a non-reporting
buildfarm setup here that I run when it's necessary to debug these
cross-version tests, and it did not show this failure.  crake itself
was passing with the pre-16 branches, so I'm mystified why 16 is
different.  Anyway, I see it's green now, so all good.

regards, tom lane




pgsql: Fix pgindent damage.

2024-03-04 Thread Robert Haas
Fix pgindent damage.

Apparently, I neglected to pgindent the prior commit.

Per buildfarm.

Branch
--
master

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

Modified Files
--
src/backend/backup/basebackup_incremental.c |  4 ++--
src/backend/postmaster/walsummarizer.c  | 34 ++---
2 files changed, 19 insertions(+), 19 deletions(-)



Re: pgsql: Remove the adminpack contrib extension

2024-03-04 Thread Daniel Gustafsson
> On 4 Mar 2024, at 17:34, Tom Lane  wrote:
> 
> Daniel Gustafsson  writes:
>> I see that my fix didn't solve it for 11 and 9.x on crake and drongo, will
>> rebuild more old trees and test to find the correct fix.
> 
> The oldest branches didn't make that DB, so you need an "IF EXISTS".
> I pushed a fix after quickly checking it here.

Thanks for fixing, much appreciated!

The deviation between database names on crake found in the follow-up commit is
a bit concerning.  Too much magic hidden away from the codetree makes it hard
to get tests right on the first try.

--
Daniel Gustafsson





pgsql: Fix incremental backup interaction with XLOG_DBASE_CREATE_FILE_C

2024-03-04 Thread Robert Haas
Fix incremental backup interaction with XLOG_DBASE_CREATE_FILE_COPY.

After XLOG_DBASE_CREATE_FILE_COPY, a correct incremental backup needs
to copy in full everything with the database and tablespace OID
mentioned in that record; but that record doesn't specifically mention
the blocks, or even the relfilenumbers, of the affected relations.
As a result, we were failing to copy data that we should have copied.

To fix, enter the DB OID and tablespace OID into the block reference
table with relfilenumber 0 and limit block 0; and treat that as a
limit block of 0 for every relfilenumber whose DB OID and tablespace
OID match.

Also, add a test case.

Patch by me, reviewed by Noah Misch.

Discussion: 
http://postgr.es/m/CA+Tgmob0xa=ByvGLMdAgkUZyVQE=r4nyyz_vea40fcfedfn...@mail.gmail.com

Branch
--
master

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

Modified Files
--
src/backend/backup/basebackup_incremental.c| 18 ++-
src/backend/postmaster/walsummarizer.c | 75 ++
src/bin/pg_combinebackup/meson.build   |  1 +
src/bin/pg_combinebackup/t/006_db_file_copy.pl | 58 
4 files changed, 151 insertions(+), 1 deletion(-)



pgsql: Further further fix pg_upgrade crossversion test for adminpack.

2024-03-04 Thread Tom Lane
Further further fix pg_upgrade crossversion test for adminpack.

Apparently, buildfarm animal crake has the adminpack regression DB
named as "regression_adminpack" in some branches.  Not clear why
I didn't see that when testing here.  In any case, drop that too.

Discussion: https://postgr.es/m/0cfb76d0-0510-48b2-9916-1199f93bc...@yesql.se

Branch
--
master

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

Modified Files
--
src/test/perl/PostgreSQL/Test/AdjustUpgrade.pm | 3 +++
1 file changed, 3 insertions(+)



pgsql: Fix initdb's -c option to treat the GUC name case-insensitively.

2024-03-04 Thread Tom Lane
Fix initdb's -c option to treat the GUC name case-insensitively.

The backend treats GUC names case-insensitively, so this code should
too.  This avoids ending up with a confusing set of redundant entries
in the generated postgresql.conf file.

Per report from Kyotaro Horiguchi.  Back-patch to v16 where this
feature was added (in commit 3e51b278d).

Discussion: 
https://postgr.es/m/20230928.164904.2153358973162534034.horikyota@gmail.com

Branch
--
REL_16_STABLE

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

Modified Files
--
src/bin/initdb/initdb.c|  9 +++--
src/bin/initdb/t/001_initdb.pl | 14 ++
2 files changed, 21 insertions(+), 2 deletions(-)



pgsql: Fix initdb's -c option to treat the GUC name case-insensitively.

2024-03-04 Thread Tom Lane
Fix initdb's -c option to treat the GUC name case-insensitively.

The backend treats GUC names case-insensitively, so this code should
too.  This avoids ending up with a confusing set of redundant entries
in the generated postgresql.conf file.

Per report from Kyotaro Horiguchi.  Back-patch to v16 where this
feature was added (in commit 3e51b278d).

Discussion: 
https://postgr.es/m/20230928.164904.2153358973162534034.horikyota@gmail.com

Branch
--
master

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

Modified Files
--
src/bin/initdb/initdb.c|  9 +++--
src/bin/initdb/t/001_initdb.pl | 14 ++
2 files changed, 21 insertions(+), 2 deletions(-)



pgsql: Rework locking code in GetMultiXactIdMembers

2024-03-04 Thread Alvaro Herrera
Rework locking code in GetMultiXactIdMembers

After commit 53c2a97a9266, the code flow around the "retry" goto label
in GetMultiXactIdMembers was confused about what was possible: we never
return there with a held lock, so there's no point in testing for one.
This realization lets us simplify the code a bit.  While at it, make the
scope of a couple of local variables in the same function a bit tighter.

Per Coverity.

Branch
--
master

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

Modified Files
--
src/backend/access/transam/multixact.c | 53 ++
1 file changed, 22 insertions(+), 31 deletions(-)



pgsql: Simplify coding in slru.c

2024-03-04 Thread Alvaro Herrera
Simplify coding in slru.c

New code in 53c2a97a9266 uses direct array access to
shared->bank_locks[bankno].lock which can be made a little bit more
legible by using the SimpleLruGetBankLock helper function.
Nothing terribly serious, but let's add some clarity.

Discussion: https://postgr.es/m/202403041517.3a35jw53os65@alvherre.pgsql

Branch
--
master

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

Modified Files
--
src/backend/access/transam/slru.c | 18 +-
1 file changed, 9 insertions(+), 9 deletions(-)



Re: pgsql: Remove the adminpack contrib extension

2024-03-04 Thread Tom Lane
Daniel Gustafsson  writes:
> I see that my fix didn't solve it for 11 and 9.x on crake and drongo, will
> rebuild more old trees and test to find the correct fix.

The oldest branches didn't make that DB, so you need an "IF EXISTS".
I pushed a fix after quickly checking it here.

regards, tom lane




pgsql: Further fix pg_upgrade crossversion test for adminpack.

2024-03-04 Thread Tom Lane
Further fix pg_upgrade crossversion test for adminpack.

The DROP DATABASE step needs an "if exists" option, as the oldest
branches we test don't have the contrib_regression_adminpack DB.
Also remove unnecessary command to drop the extension from the
regression database; no version has installed it there during
buildfarm testing.

Discussion: https://postgr.es/m/0cfb76d0-0510-48b2-9916-1199f93bc...@yesql.se

Branch
--
master

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

Modified Files
--
src/test/perl/PostgreSQL/Test/AdjustUpgrade.pm | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)



Re: pgsql: Remove the adminpack contrib extension

2024-03-04 Thread Daniel Gustafsson
> On 4 Mar 2024, at 16:27, Alvaro Herrera  wrote:
> 
> On 2024-Mar-04, Daniel Gustafsson wrote:
> 
>> The pg_upgrade Xversion test on crake failed on this, I'm trying to reproduce
>> the cross-version test locally to verify the below diff but it's right now
>> failing on an unrelated thing.
> 
> What unrelated thing?  

I was trying to get the crossversion tests to work with make check, but was
only able to get them running properly with make installcheck, will investigate
that further.  So unrelated to the specific failure at hand, not unrelated to
crossversion testing.

> I suggest to try to initdb the old version with
> the current REL_12_STABLE branch tip, because IIRC there are changes
> that cause the pg_upgrade test to fail.

I see that my fix didn't solve it for 11 and 9.x on crake and drongo, will
rebuild more old trees and test to find the correct fix.

--
Daniel Gustafsson





Re: pgsql: Remove the adminpack contrib extension

2024-03-04 Thread Alvaro Herrera
On 2024-Mar-04, Daniel Gustafsson wrote:

> The pg_upgrade Xversion test on crake failed on this, I'm trying to reproduce
> the cross-version test locally to verify the below diff but it's right now
> failing on an unrelated thing.

What unrelated thing?  I suggest to try to initdb the old version with
the current REL_12_STABLE branch tip, because IIRC there are changes
that cause the pg_upgrade test to fail.

-- 
Álvaro Herrera PostgreSQL Developer  —  https://www.EnterpriseDB.com/
Y una voz del caos me habló y me dijo
"Sonríe y sé feliz, podría ser peor".
Y sonreí. Y fui feliz.
Y fue peor.




pgsql: Fix crossversion test for unsupported versions

2024-03-04 Thread Daniel Gustafsson
Fix crossversion test for unsupported versions

The fix in be78006741 only accounted for supported versions of postgres
but the crossversion test use 11 as the source version, which is an EOL
version.  Fix by removing the lower bound in the adminpack cleanup.

Discussion: https://postgr.es/m/0cfb76d0-0510-48b2-9916-1199f93bc...@yesql.se

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/084cff7899d62c142f5c5190ef6924a0ffe93893

Modified Files
--
src/test/perl/PostgreSQL/Test/AdjustUpgrade.pm | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)



pgsql: Adjust pg_upgrade crossversion test for adminpack

2024-03-04 Thread Daniel Gustafsson
Adjust pg_upgrade crossversion test for adminpack

Commit cc09e6549f which removed the adminpack extension failed to
instrument the crossversion pg_upgrade test to drop the extension
before attempting an upgrade to v17.

Discussion: https://postgr.es/m/0cfb76d0-0510-48b2-9916-1199f93bc...@yesql.se

Branch
--
master

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

Modified Files
--
src/test/perl/PostgreSQL/Test/AdjustUpgrade.pm | 10 ++
1 file changed, 10 insertions(+)



Re: pgsql: Remove the adminpack contrib extension

2024-03-04 Thread Daniel Gustafsson
> On 4 Mar 2024, at 12:43, Daniel Gustafsson  wrote:
> 
> Remove the adminpack contrib extension

The pg_upgrade Xversion test on crake failed on this, I'm trying to reproduce
the cross-version test locally to verify the below diff but it's right now
failing on an unrelated thing.  If anyone has a working setup locally to test I
would love the below taken for a spin against something in 16->12.

diff --git a/src/test/perl/PostgreSQL/Test/AdjustUpgrade.pm 
b/src/test/perl/PostgreSQL/Test/AdjustUpgrade.pm
index c0da0aaff8..8dc1a65e3d 100644
--- a/src/test/perl/PostgreSQL/Test/AdjustUpgrade.pm
+++ b/src/test/perl/PostgreSQL/Test/AdjustUpgrade.pm
@@ -106,6 +106,16 @@ sub adjust_database_contents
'drop extension if exists test_ext7');
}
 
+   # we removed the adminpack extension in v17
+   if ($old_version >= 12 && $old_version < 17)
+   {
+   _add_st($result, 'regression',
+   'drop extension if exists adminpack');
+   _add_st($result, 'postgres',
+   'drop database contrib_regression_adminpack');
+   delete($dbnames{'contrib_regression_adminpack'});
+   }
+
# we removed this test-support function in v17
if ($old_version >= 15 && $old_version < 17)
{

--
Daniel Gustafsson





pgsql: Put back required #include

2024-03-04 Thread Peter Eisentraut
Put back required #include

Fix for dbbca2cf29: "storage/shmem.h" is required with
-Dspinlocks=false.

Branch
--
master

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

Modified Files
--
src/backend/storage/lmgr/spin.c | 1 +
1 file changed, 1 insertion(+)



pgsql: Remove the adminpack contrib extension

2024-03-04 Thread Daniel Gustafsson
Remove the adminpack contrib extension

The adminpack extension was only used to support pgAdmin III,  which
in turn was declared EOL many years ago. Removing the extension also
allows us to remove functions from core as well which were only used
to support old version of adminpack.

Reviewed-by: Tom Lane 
Reviewed-by: Nathan Bossart 
Reviewed-by: Bharath Rupireddy 
Discussion: 
https://postgr.es/m/CALj2ACUmL5TraYBUBqDZBi1C+Re8_=sekqgyqyprj_w8wyg...@mail.gmail.com

Branch
--
master

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

Modified Files
--
contrib/Makefile  |   1 -
contrib/adminpack/.gitignore  |   4 -
contrib/adminpack/Makefile|  24 --
contrib/adminpack/adminpack--1.0--1.1.sql |   6 -
contrib/adminpack/adminpack--1.0.sql  |  53 ---
contrib/adminpack/adminpack--1.1--2.0.sql |  51 ---
contrib/adminpack/adminpack--2.0--2.1.sql |  17 -
contrib/adminpack/adminpack.c | 591 --
contrib/adminpack/adminpack.control   |   6 -
contrib/adminpack/expected/adminpack.out  | 172 -
contrib/adminpack/meson.build |  35 --
contrib/adminpack/sql/adminpack.sql   |  76 
contrib/meson.build   |   1 -
doc/src/sgml/adminpack.sgml   | 159 
doc/src/sgml/contrib.sgml |   1 -
doc/src/sgml/filelist.sgml|   1 -
src/backend/storage/ipc/signalfuncs.c |  29 +-
src/backend/utils/adt/genfile.c   |  46 ---
src/include/catalog/catversion.h  |   2 +-
src/include/catalog/pg_proc.dat   |   7 -
20 files changed, 2 insertions(+), 1280 deletions(-)



pgsql: Remove unused #include's from backend .c files

2024-03-04 Thread Peter Eisentraut
Remove unused #include's from backend .c files

as determined by include-what-you-use (IWYU)

While IWYU also suggests to *add* a bunch of #include's (which is its
main purpose), this patch does not do that.  In some cases, a more
specific #include replaces another less specific one.

Some manual adjustments of the automatic result:

- IWYU currently doesn't know about includes that provide global
  variable declarations (like -Wmissing-variable-declarations), so
  those includes are being kept manually.

- All includes for port(ability) headers are being kept for now, to
  play it safe.

- No changes of catalog/pg_foo.h to catalog/pg_foo_d.h, to keep the
  patch from exploding in size.

Note that this patch touches just *.c files, so nothing declared in
header files changes in hidden ways.

As a small example, in src/backend/access/transam/rmgr.c, some IWYU
pragma annotations are added to handle a special case there.

Discussion: 
https://www.postgresql.org/message-id/flat/af837490-6b2f-46df-ba05-37ea6a6653fc%40eisentraut.org

Branch
--
master

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

Modified Files
--
src/backend/access/brin/brin.c |  2 +-
src/backend/access/brin/brin_bloom.c   |  9 +++-
src/backend/access/brin/brin_inclusion.c   |  2 +-
src/backend/access/brin/brin_minmax.c  |  4 +---
src/backend/access/brin/brin_minmax_multi.c|  1 -
src/backend/access/brin/brin_pageops.c |  1 -
src/backend/access/brin/brin_revmap.c  |  1 -
src/backend/access/common/attmap.c |  1 -
src/backend/access/common/heaptuple.c  |  1 -
src/backend/access/common/printtup.c   |  1 -
src/backend/access/common/relation.c   |  1 -
src/backend/access/common/reloptions.c |  2 --
src/backend/access/common/toast_compression.c  |  2 --
src/backend/access/common/toast_internals.c|  1 -
src/backend/access/gin/ginarrayproc.c  |  2 +-
src/backend/access/gin/ginentrypage.c  |  1 -
src/backend/access/gin/ginfast.c   |  2 +-
src/backend/access/gin/gininsert.c |  5 +---
src/backend/access/gin/ginlogic.c  |  6 -
src/backend/access/gin/ginutil.c   |  3 +--
src/backend/access/gin/ginvalidate.c   |  2 --
src/backend/access/gist/gist.c |  3 +--
src/backend/access/gist/gistbuild.c|  3 +--
src/backend/access/gist/gistbuildbuffers.c |  4 
src/backend/access/gist/gistget.c  |  1 -
src/backend/access/gist/gistproc.c |  2 +-
src/backend/access/gist/gistutil.c |  3 +--
src/backend/access/gist/gistvalidate.c |  1 -
src/backend/access/gist/gistxlog.c |  4 +---
src/backend/access/hash/hash.c |  6 ++---
src/backend/access/hash/hash_xlog.c|  5 +---
src/backend/access/hash/hashfunc.c |  4 +---
src/backend/access/hash/hashinsert.c   |  2 --
src/backend/access/hash/hashpage.c |  2 +-
src/backend/access/hash/hashutil.c |  1 -
src/backend/access/heap/heapam.c   |  4 
src/backend/access/heap/heapam_visibility.c|  2 --
src/backend/access/heap/hio.c  |  1 -
src/backend/access/heap/pruneheap.c|  2 --
src/backend/access/heap/rewriteheap.c  |  2 --
src/backend/access/heap/vacuumlazy.c   |  6 -
src/backend/access/heap/visibilitymap.c|  2 +-
src/backend/access/index/amapi.c   |  2 +-
src/backend/access/index/genam.c   |  3 ---
src/backend/access/index/indexam.c |  9 ++--
src/backend/access/nbtree/nbtcompare.c |  2 +-
src/backend/access/nbtree/nbtinsert.c  |  1 -
src/backend/access/nbtree/nbtpage.c|  1 -
src/backend/access/nbtree/nbtree.c |  6 ++---
src/backend/access/nbtree/nbtsort.c|  1 -
src/backend/access/nbtree/nbtsplitloc.c|  1 -
src/backend/access/nbtree/nbtutils.c   |  1 -
src/backend/access/nbtree/nbtxlog.c|  4 +---
src/backend/access/rmgrdesc/committsdesc.c |  1 -
src/backend/access/rmgrdesc/genericdesc.c  |  1 -
src/backend/access/rmgrdesc/gindesc.c  |  2 --
src/backend/access/rmgrdesc/gistdesc.c |  1 -
src/backend/access/spgist/spginsert.c  |  4 +---
src/backend/access/spgist/spgkdtreeproc.c  |  2 +-
src/backend/access/spgist/spgproc.c|  2 +-
src/backend/access/spgist/spgquadtreeproc.c|  2 +-
src/backend/access/spgist/spgtextproc.c|  2 +-
src/backend/access/spgist/spgutils.c   |  4 ++--
src/backend/access/spgist/spgvacuum.c  |  1 -

pgsql: Remove unused ParallelWorkerInfo.pid field

2024-03-04 Thread Heikki Linnakangas
Remove unused ParallelWorkerInfo.pid field

The pid was originally used in error context of messages propagated
from parallel workers, but commit 292794f82b removed that. If the need
arises in the future, you can also get the pid with
"shm_mq_get_sender(pcxt->worker[i].error_mqh)->pid".

Branch
--
master

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

Modified Files
--
src/backend/access/transam/parallel.c | 23 ---
src/include/access/parallel.h |  1 -
2 files changed, 24 deletions(-)



pgsql: Remove unused 'countincludesself' argument to pq_sendcountedtext

2024-03-04 Thread Heikki Linnakangas
Remove unused 'countincludesself' argument to pq_sendcountedtext()

It has been unused since we removed support for protocol version 2.

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/24eebc65c26cfcc0ea5b8a95b61fa2fda6118e68

Modified Files
--
src/backend/access/common/printsimple.c |  9 -
src/backend/access/common/printtup.c|  2 +-
src/backend/libpq/pqformat.c| 15 ++-
src/backend/replication/logical/proto.c |  2 +-
src/backend/tcop/fastpath.c |  2 +-
src/include/libpq/pqformat.h|  3 +--
6 files changed, 14 insertions(+), 19 deletions(-)



pgsql: Fix doc omission for MERGE into updatable views.

2024-03-04 Thread Dean Rasheed
Fix doc omission for MERGE into updatable views.

Commit 5f2e179bd3 missed one place in rules.sgml that should have
mentioned MERGE. Also, be more specific when saying that MERGE doesn't
support rules, since it does support SELECT rules.

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/8545b28679a2ec2aa66ad2ec81f17019dab5d780

Modified Files
--
doc/src/sgml/rules.sgml | 6 --
1 file changed, 4 insertions(+), 2 deletions(-)



pgsql: doc: Fix datatype for postgres_fdw option

2024-03-04 Thread Daniel Gustafsson
doc: Fix datatype for postgres_fdw option

The datatype for analyze_sampling had accidentally been set to text
and not string.  Backpatch to v16 where analyze_sampling first was
introduced.

Author: Shinya Kato 
Reviewed-by: Laurenz Albe 
Discussion: https://postgr.es/m/7fd9166b9fda267411793f39986d7...@oss.nttdata.com
Backpatch-through: v16

Branch
--
REL_16_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/896bd6da8e2bfcf912cd8c2d4f07e4656b3f8155

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



pgsql: doc: Fix datatype for postgres_fdw option

2024-03-04 Thread Daniel Gustafsson
doc: Fix datatype for postgres_fdw option

The datatype for analyze_sampling had accidentally been set to text
and not string.  Backpatch to v16 where analyze_sampling first was
introduced.

Author: Shinya Kato 
Reviewed-by: Laurenz Albe 
Discussion: https://postgr.es/m/7fd9166b9fda267411793f39986d7...@oss.nttdata.com
Backpatch-through: v16

Branch
--
master

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

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



pgsql: Remove MyAuxProcType, use MyBackendType instead

2024-03-04 Thread Heikki Linnakangas
Remove MyAuxProcType, use MyBackendType instead

MyAuxProcType was redundant with MyBackendType.

Reviewed-by: Reid Thompson, Andres Freund
Discussion: 
https://www.postgresql.org/message-id/f3ecd4cb-85ee-4e54-8278-5fabfb3a4...@iki.fi

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/067701f57758f9baed5bd9d868539738d77bfa92

Modified Files
--
src/backend/postmaster/auxprocess.c | 58 ++---
src/backend/postmaster/postmaster.c | 56 ++--
src/include/miscadmin.h | 73 ++---
src/include/postmaster/auxprocess.h |  2 +-
src/tools/pgindent/typedefs.list|  1 -
5 files changed, 75 insertions(+), 115 deletions(-)



pgsql: Use MyBackendType in more places to check what process this is

2024-03-04 Thread Heikki Linnakangas
Use MyBackendType in more places to check what process this is

Remove IsBackgroundWorker, IsAutoVacuumLauncherProcess(),
IsAutoVacuumWorkerProcess(), and IsLogicalSlotSyncWorker() in favor of
new Am*Process() macros that use MyBackendType. For consistency with
the existing Am*Process() macros.

Reviewed-by: Andres Freund
Discussion: 
https://www.postgresql.org/message-id/f3ecd4cb-85ee-4e54-8278-5fabfb3a4...@iki.fi

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/393b5599e5177e456cdce500039813629d370b38

Modified Files
--
src/backend/access/gin/ginfast.c |  2 +-
src/backend/access/gin/ginvacuum.c   |  6 +++---
src/backend/access/heap/vacuumlazy.c |  4 ++--
src/backend/commands/analyze.c   |  4 ++--
src/backend/commands/vacuum.c|  8 
src/backend/postmaster/autovacuum.c  | 26 --
src/backend/postmaster/bgworker.c|  2 --
src/backend/postmaster/postmaster.c  |  3 ---
src/backend/replication/logical/slotsync.c   | 16 +---
src/backend/statistics/extended_stats.c  |  2 +-
src/backend/storage/ipc/ipc.c|  2 +-
src/backend/storage/lmgr/proc.c  | 23 +++
src/backend/tcop/postgres.c  |  6 +++---
src/backend/utils/activity/pgstat_relation.c |  4 ++--
src/backend/utils/init/globals.c |  1 -
src/backend/utils/init/miscinit.c|  4 ++--
src/backend/utils/init/postinit.c|  8 
src/include/miscadmin.h  |  6 +-
src/include/postmaster/autovacuum.h  |  5 -
src/include/replication/slotsync.h   |  1 -
20 files changed, 42 insertions(+), 91 deletions(-)