pgsql: Support invalidating replication slots due to horizon and wal_le

2023-04-07 Thread Andres Freund
Support invalidating replication slots due to horizon and wal_level Needed for logical decoding on a standby. Slots need to be invalidated because of the horizon if rows required for logical decoding are removed. If the primary's wal_level is lowered from 'logical', logical slots on the standby ne

pgsql: Fix underspecified sort order in inherit.sql

2023-04-07 Thread Andres Freund
Fix underspecified sort order in inherit.sql Introduced in e056c557aef4. Per buildfarm member prion. Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/2ed16aacf1af1e1a26bffb121a19d1ad5f5177f0 Modified Files -- src/test/regress/expected/inherit.out | 9 ++

pgsql: Prevent use of invalidated logical slot in CreateDecodingContext

2023-04-07 Thread Andres Freund
Prevent use of invalidated logical slot in CreateDecodingContext() Previously we had checks for this in multiple places. Support for logical decoding on standbys will add other forms of invalidation, making it worth while to centralize the checks. This slightly changes the error message for both

pgsql: Replace replication slot's invalidated_at LSN with an enum

2023-04-07 Thread Andres Freund
Replace replication slot's invalidated_at LSN with an enum This is mainly useful because the upcoming logical-decoding-on-standby feature adds further reasons for invalidating slots, and we don't want to end up with multiple invalidated_* fields, or check different attributes. Eventually we shoul

pgsql: Introduce PG_IO_ALIGN_SIZE and align all I/O buffers.

2023-04-07 Thread Thomas Munro
Introduce PG_IO_ALIGN_SIZE and align all I/O buffers. In order to have the option to use O_DIRECT/FILE_FLAG_NO_BUFFERING in a later commit, we need the addresses of user space buffers to be well aligned. The exact requirements vary by OS and file system (typically sectors and/or memory pages). T

pgsql: Add io_direct setting (developer-only).

2023-04-07 Thread Thomas Munro
Add io_direct setting (developer-only). Provide a way to ask the kernel to use O_DIRECT (or local equivalent) where available for data and WAL files, to avoid or minimize kernel caching. This hurts performance currently and is not intended for end users yet. Later proposed work would introduce o

pgsql: Doc: Fix the datatype of the newly added SUBSCRIPTION options.

2023-04-07 Thread Amit Kapila
Doc: Fix the datatype of the newly added SUBSCRIPTION options. In docs, the datatype of "password_required" and "run_as_owner" was incorrectly specified as a string. Author: Amit Kapila Reviewed-by: Sawada Masahiko Discussion: https://postgr.es/m/CAHut+Pu=pnJf=ss1583pknsq3cboqlckwcjcqyt6zxtaghe.

pgsql: Add missing .gitignore entry.

2023-04-07 Thread Tom Lane
Add missing .gitignore entry. Seems an oversight in 7d8219a44. Fix before somebody commits a generated file. Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/db6957bae8d7716785aa3748b25a9a4b7c3ff304 Modified Files -- src/bin/pg_waldump/.gitignore | 1 +

pgsql: Remove useless dependencies in daitch_mokotoff_header.pl.

2023-04-07 Thread Tom Lane
Remove useless dependencies in daitch_mokotoff_header.pl. Actually, the correct fix for this is "we don't need this at all", because this program isn't dealing in any non-ASCII data. The dependency on Data::Dumper seems to be a leftover too. Discussion: https://postgr.es/m/3287943.1680922...@sss

pgsql: Add support for Kerberos credential delegation

2023-04-07 Thread Stephen Frost
Add support for Kerberos credential delegation Support GSSAPI/Kerberos credentials being delegated to the server by a client. With this, a user authenticating to PostgreSQL using Kerberos (GSSAPI) credentials can choose to delegate their credentials to the PostgreSQL server (which can choose to a

pgsql: Pacify perlcritic.

2023-04-07 Thread Tom Lane
Pacify perlcritic. Discussion: https://postgr.es/m/3271512.1680916...@sss.pgh.pa.us Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/edc627ae27632ae2be0e435aca02ed38005cb55f Modified Files -- contrib/fuzzystrmatch/daitch_mokotoff_header.pl | 2 +- 1 file

pgsql: Track IO times in pg_stat_io

2023-04-07 Thread Andres Freund
Track IO times in pg_stat_io a9c70b46dbe and 8aaa04b32S added counting of IO operations to a new view, pg_stat_io. Now, add IO timing for reads, writes, extends, and fsyncs to pg_stat_io as well. This combines the tracking for pgBufferUsage with the tracking for pg_stat_io into a new function pgs

pgsql: Show more detail in nbtree rmgr descriptions.

2023-04-07 Thread Peter Geoghegan
Show more detail in nbtree rmgr descriptions. Show a detailed description of the page offset number arrays that appear in certain nbtree WAL records. Also brings nbtree desc routines in line with the guidelines established by recent commit 7d8219a4. Author: Melanie Plageman Reviewed-By: Peter G

pgsql: For Kerberos testing, disable DNS lookups

2023-04-07 Thread Stephen Frost
For Kerberos testing, disable DNS lookups Similar to 8dff2f224, this disables DNS lookups by the Kerberos library to look up the KDC and the realm while the Kerberos tests are running. In some environments, these lookups can take a long time and end up timing out and causing tests to fail. Furthe

pgsql: For Kerberos testing, disable reverse DNS lookup

2023-04-07 Thread Stephen Frost
For Kerberos testing, disable reverse DNS lookup In our Kerberos test suite, there isn't much need to worry about the normal canonicalization that Kerberos provides by looking up the reverse DNS for the IP address connected to, and in some cases it can actively cause problems (eg: a captive portal

pgsql: For Kerberos testing, disable reverse DNS lookup

2023-04-07 Thread Stephen Frost
For Kerberos testing, disable reverse DNS lookup In our Kerberos test suite, there isn't much need to worry about the normal canonicalization that Kerberos provides by looking up the reverse DNS for the IP address connected to, and in some cases it can actively cause problems (eg: a captive portal

pgsql: For Kerberos testing, disable DNS lookups

2023-04-07 Thread Stephen Frost
For Kerberos testing, disable DNS lookups Similar to 8dff2f224, this disables DNS lookups by the Kerberos library to look up the KDC and the realm while the Kerberos tests are running. In some environments, these lookups can take a long time and end up timing out and causing tests to fail. Furthe

pgsql: For Kerberos testing, disable DNS lookups

2023-04-07 Thread Stephen Frost
For Kerberos testing, disable DNS lookups Similar to 8dff2f224, this disables DNS lookups by the Kerberos library to look up the KDC and the realm while the Kerberos tests are running. In some environments, these lookups can take a long time and end up timing out and causing tests to fail. Furthe

pgsql: For Kerberos testing, disable DNS lookups

2023-04-07 Thread Stephen Frost
For Kerberos testing, disable DNS lookups Similar to 8dff2f224, this disables DNS lookups by the Kerberos library to look up the KDC and the realm while the Kerberos tests are running. In some environments, these lookups can take a long time and end up timing out and causing tests to fail. Furthe

pgsql: For Kerberos testing, disable DNS lookups

2023-04-07 Thread Stephen Frost
For Kerberos testing, disable DNS lookups Similar to 8dff2f224, this disables DNS lookups by the Kerberos library to look up the KDC and the realm while the Kerberos tests are running. In some environments, these lookups can take a long time and end up timing out and causing tests to fail. Furthe

pgsql: For Kerberos testing, disable DNS lookups

2023-04-07 Thread Stephen Frost
For Kerberos testing, disable DNS lookups Similar to 8dff2f224, this disables DNS lookups by the Kerberos library to look up the KDC and the realm while the Kerberos tests are running. In some environments, these lookups can take a long time and end up timing out and causing tests to fail. Furthe

pgsql: For Kerberos testing, disable reverse DNS lookup

2023-04-07 Thread Stephen Frost
For Kerberos testing, disable reverse DNS lookup In our Kerberos test suite, there isn't much need to worry about the normal canonicalization that Kerberos provides by looking up the reverse DNS for the IP address connected to, and in some cases it can actively cause problems (eg: a captive portal

pgsql: For Kerberos testing, disable reverse DNS lookup

2023-04-07 Thread Stephen Frost
For Kerberos testing, disable reverse DNS lookup In our Kerberos test suite, there isn't much need to worry about the normal canonicalization that Kerberos provides by looking up the reverse DNS for the IP address connected to, and in some cases it can actively cause problems (eg: a captive portal

pgsql: For Kerberos testing, disable reverse DNS lookup

2023-04-07 Thread Stephen Frost
For Kerberos testing, disable reverse DNS lookup In our Kerberos test suite, there isn't much need to worry about the normal canonicalization that Kerberos provides by looking up the reverse DNS for the IP address connected to, and in some cases it can actively cause problems (eg: a captive portal

pgsql: Show more detail in heapam rmgr descriptions.

2023-04-07 Thread Peter Geoghegan
Show more detail in heapam rmgr descriptions. Add helper functions that output arrays in a standard format, and use the functions inside heapdesc routines. This allows tools like pg_walinspect to show a detailed description of the page offset number arrays for records like PRUNE and VACUUM (unles

pgsql: Adjust contrib/sepgsql regression test expected outputs.

2023-04-07 Thread Tom Lane
Adjust contrib/sepgsql regression test expected outputs. Per buildfarm, the log output has changed as a consequence of commit e056c557a changing the catalog accesses performed in some commands. Discussion: https://postgr.es/m/20230407211950.aojbdirwdrxje...@awork3.anarazel.de Branch -- mast

pgsql: Add support for Daitch-Mokotoff Soundex in contrib/fuzzystrmatch

2023-04-07 Thread Tom Lane
Add support for Daitch-Mokotoff Soundex in contrib/fuzzystrmatch. This modernized version of Soundex works significantly better than the original, particularly for non-English names. Dag Lem, reviewed by quite a few people along the way Discussion: https://postgr.es/m/yger1atbgfy@sid.nimrod.

pgsql: Fix table name clash in recently introduced test

2023-04-07 Thread Andres Freund
Fix table name clash in recently introduced test A few buildfarm animals recently started complaining about the "child" relation already existing. e056c557aef added a new child table to inherit.sql, but triggers.sql, running in the same parallel group, also uses a child table. Rename the new tabl

pgsql: Improve IO accounting for temp relation writes

2023-04-07 Thread Andres Freund
Improve IO accounting for temp relation writes Both pgstat_database and pgBufferUsage count IO timing for reads of temporary relation blocks into local buffers. However, both failed to count write IO timing for flushes of dirty local buffers. Fix. Additionally, FlushRelationBuffers() seems to hav

pgsql: Test SCRAM iteration changes with psql \password

2023-04-07 Thread Daniel Gustafsson
Test SCRAM iteration changes with psql \password A version of this test was included in the original patch for altering SCRAM iteration count, but was omitted due to how interactive psql TAP sessions worked before being refactored. Discussion: https://postgr.es/m/20230130194350.zj5v467x4jgqt...@

pgsql: Refactor background psql TAP functions

2023-04-07 Thread Daniel Gustafsson
Refactor background psql TAP functions This breaks out the background and interactive psql functionality into a new class, PostgreSQL::Test::BackgroundPsql. Sessions are still initiated via PostgreSQL::Test::Cluster, but once started they can be manipulated by the new helper functions which inten

pgsql: Fix underspecified sort order in test query

2023-04-07 Thread Alvaro Herrera
Fix underspecified sort order in test query Fail in e056c557aef4. Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/32bc0d022dee250fac9fc787226abed96b8ff894 Modified Files -- src/test/regress/expected/inherit.out | 8 src/test/regress/sql/inherit.

pgsql: Add pg_buffercache_usage_counts() to contrib/pg_buffercache.

2023-04-07 Thread Tom Lane
Add pg_buffercache_usage_counts() to contrib/pg_buffercache. It was pointed out that pg_buffercache_summary()'s report of the overall average usage count isn't that useful, and what would be more helpful in many cases is to report totals for each possible usage count. Add a new function to do it

pgsql: Catalog NOT NULL constraints

2023-04-07 Thread Alvaro Herrera
Catalog NOT NULL constraints We now create pg_constaint rows for NOT NULL constraints with contype='n'. We propagate these constraints during operations such as adding inheritance relationships, creating and attaching partitions, creating tables LIKE other tables. We mostly follow the well-known

pgsql: Doc: improve descriptions of max_[pred_]locks_per_transaction GU

2023-04-07 Thread Tom Lane
Doc: improve descriptions of max_[pred_]locks_per_transaction GUCs. The old wording described these as being multiplied by max_connections plus max_prepared_transactions, which hasn't been exactly right for some time thanks to the addition of various auxiliary processes. Moreover, exactness here i

pgsql: Add array_sample() and array_shuffle() functions.

2023-04-07 Thread Tom Lane
Add array_sample() and array_shuffle() functions. These are useful in Monte Carlo applications. Martin Kalcher, reviewed/adjusted by Daniel Gustafsson and myself Discussion: https://postgr.es/m/9d160a44-7675-51e8-60cf-6d64b76db...@aboutsource.net Branch -- master Details --- https://g

pgsql: Fix locale-dependent test case.

2023-04-07 Thread Tom Lane
Fix locale-dependent test case. psql parses the interval argument of \watch with locale-dependent strtod(). In commit 00beecfe8 I added a test case that exercises a fractional interval, but I hard-coded 0.01 which doesn't work in locales where the radix point isn't ".". We don't want to change t

Re: pgsql: psql: add an optional execution-count limit to \watch.

2023-04-07 Thread Alexander Korotkov
On Fri, Apr 7, 2023 at 5:00 PM Tom Lane wrote: > Alexander Korotkov writes: > > On Thu, Apr 6, 2023 at 8:18 PM Tom Lane wrote: > >> psql: add an optional execution-count limit to \watch. > > > This commit makes tests fail for me. psql parses 'i' option of > > '\watch' using locale-aware strtod(

Re: pgsql: psql: add an optional execution-count limit to \watch.

2023-04-07 Thread Tom Lane
Alexander Korotkov writes: > On Thu, Apr 6, 2023 at 8:18 PM Tom Lane wrote: >> psql: add an optional execution-count limit to \watch. > This commit makes tests fail for me. psql parses 'i' option of > '\watch' using locale-aware strtod(), but 001_basic.pl uses hard-coded > decimal separator. H

Re: pgsql: psql: add an optional execution-count limit to \watch.

2023-04-07 Thread Alexander Korotkov
Hi! On Thu, Apr 6, 2023 at 8:18 PM Tom Lane wrote: > psql: add an optional execution-count limit to \watch. > > \watch can now be told to stop after N executions of the query. This commit makes tests fail for me. psql parses 'i' option of '\watch' using locale-aware strtod(), but 001_basic.pl u

pgsql: Fix copy-paste bug in 12f3867f553 triggering an assert after a w

2023-04-07 Thread Andres Freund
Fix copy-paste bug in 12f3867f553 triggering an assert after a write error The same condition accidentally was copied to both branches. Manual testing confirms that otherwise the error recovery path works fine. Found while reviewing the logical-decoding-on-standby patch. Branch -- master De