pgsql: Simplify version check for SKIP clause

2023-04-08 Thread Daniel Gustafsson
Simplify version check for SKIP clause Checking for the required versions of IO::Pty as well as IPC::Run can be achieved with a single eval call, and by using the VERSION function the comparison is guaranteed to follow the same rules as calling 'use' on the module with a version. Reported-by:

Re: pgsql: Skip \password TAP test on old IPC::Run versions

2023-04-08 Thread Daniel Gustafsson
> On 8 Apr 2023, at 22:37, Andrew Dunstan wrote: > On 2023-04-08 Sa 16:20, Daniel Gustafsson wrote: >>> On 8 Apr 2023, at 18:23, Tom Lane >>> wrote: >>> >>> Andrew Dunstan >>> >>> writes: >>> Stylistic nitpick: It's not necessary to have 2 evals here: + skip "IO::Pty and

Re: pgsql: Skip \password TAP test on old IPC::Run versions

2023-04-08 Thread Andrew Dunstan
On 2023-04-08 Sa 16:30, Tom Lane wrote: Daniel Gustafsson writes: On 8 Apr 2023, at 18:23, Tom Lane wrote: Can't we write "use IPC::Run 0.98;" and let some other code manage the version comparison? We can, but that AFAIK (Andrew might have a better answer) requires the below diff which I

Re: pgsql: Skip \password TAP test on old IPC::Run versions

2023-04-08 Thread Andrew Dunstan
On 2023-04-08 Sa 16:20, Daniel Gustafsson wrote: On 8 Apr 2023, at 18:23, Tom Lane wrote: Andrew Dunstan writes: Stylistic nitpick: It's not necessary to have 2 evals here: + skip "IO::Pty and IPC::Run >= 0.98 required", 1 unless + (eval { require IO::Pty; } && eval {

pgsql: Use higher wal_level for 004_io_direct.pl.

2023-04-08 Thread Thomas Munro
Use higher wal_level for 004_io_direct.pl. The new direct I/O test deliberately uses a very small shared_buffers to force some disk transfers without making the data set large and slow, but ran into a problem with wal_level = minimal: log_newpage_range() pins many buffers, leading to a few

Re: pgsql: Skip \password TAP test on old IPC::Run versions

2023-04-08 Thread Tom Lane
Daniel Gustafsson writes: > On 8 Apr 2023, at 18:23, Tom Lane wrote: >> Can't we write "use IPC::Run 0.98;" and let >> some other code manage the version comparison? > We can, but that AFAIK (Andrew might have a better answer) requires the below > diff which I think leaves some readability to

Re: pgsql: Skip \password TAP test on old IPC::Run versions

2023-04-08 Thread Daniel Gustafsson
> On 8 Apr 2023, at 18:23, Tom Lane wrote: > > Andrew Dunstan writes: >> Stylistic nitpick: It's not necessary to have 2 evals here: > >> + skip "IO::Pty and IPC::Run >= 0.98 required", 1 unless >> + (eval { require IO::Pty; } && eval { $IPC::Run::VERSION >= >> '0.98' }); > >> just

Re: pgsql: Try to unbreak MSVC builds for pg_waldump

2023-04-08 Thread Andrew Dunstan
On 2023-04-08 Sa 14:13, Andres Freund wrote: Hi, On 2023-04-08 13:53:34 -0400, Tom Lane wrote: Peter Geoghegan writes: I was under the impression that issues like this would be caught by CI. We used to have an MSVC CI target, but that's no longer the case -- not since commit e6b6ea02. I'll

Re: pgsql: Try to unbreak MSVC builds for pg_waldump

2023-04-08 Thread Andres Freund
Hi, On 2023-04-08 13:53:34 -0400, Tom Lane wrote: > Peter Geoghegan writes: > > I was under the impression that issues like this would be caught by > > CI. We used to have an MSVC CI target, but that's no longer the case > > -- not since commit e6b6ea02. I'll need to remember that. > > I thought

Re: pgsql: Try to unbreak MSVC builds for pg_waldump

2023-04-08 Thread Peter Geoghegan
On Sat, Apr 8, 2023 at 10:53 AM Tom Lane wrote: > I thought we were planning to drop the MSVC build scripts for v16. > Is that no longer happening? If they're going to be around for > awhile, maybe that CI job needs to be resurrected. It seems as if commit e6b6ea02 had very good reasons to

Re: pgsql: Try to unbreak MSVC builds for pg_waldump

2023-04-08 Thread Tom Lane
Peter Geoghegan writes: > I was under the impression that issues like this would be caught by > CI. We used to have an MSVC CI target, but that's no longer the case > -- not since commit e6b6ea02. I'll need to remember that. I thought we were planning to drop the MSVC build scripts for v16. Is

Re: pgsql: Try to unbreak MSVC builds for pg_waldump

2023-04-08 Thread Peter Geoghegan
On Sat, Apr 8, 2023 at 8:22 AM Andrew Dunstan wrote: > Try to unbreak MSVC builds for pg_waldump > > remedy an omission in commit 7d8219a444 Thanks for taking care of this. I was under the impression that issues like this would be caught by CI. We used to have an MSVC CI target, but that's no

Re: pgsql: Skip \password TAP test on old IPC::Run versions

2023-04-08 Thread Tom Lane
Andrew Dunstan writes: > Stylistic nitpick: It's not necessary to have 2 evals here: > +   skip "IO::Pty and IPC::Run >= 0.98 required", 1 unless > +   (eval { require IO::Pty; } && eval { $IPC::Run::VERSION >= > '0.98' }); > just say "eval { require IO::Pty; return $IPC::Run::VERSION >=

pgsql: Improve indentation of multiline initialization expressions.

2023-04-08 Thread Tom Lane
Improve indentation of multiline initialization expressions. If a variable has an initialization expression that wraps onto the next line(s), pg_bsd_indent will now indent the continuation lines one stop, instead of aligning them flush with the variable declaration. We've been holding off

Re: pgsql: Skip \password TAP test on old IPC::Run versions

2023-04-08 Thread Andrew Dunstan
On 2023-04-08 Sa 09:57, Daniel Gustafsson wrote: Skip \password TAP test on old IPC::Run versions IPC::Run versions prior to 0.98 cause the interactive session to time out, so SKIP the test in case these versions are detected (they are within the base requirement for our TAP tests in general).

pgsql: Try to unbreak MSVC builds for pg_waldump

2023-04-08 Thread Andrew Dunstan
Try to unbreak MSVC builds for pg_waldump remedy an omission in commit 7d8219a444 Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/bbec50de16d2bf6e1a2878ff0f7e39dbd86ecff8 Modified Files -- src/tools/msvc/Mkvcbuild.pm | 2 +- 1 file changed, 1

pgsql: Suppress bogus printout during new 035_standby_logical_decoding.

2023-04-08 Thread Tom Lane
Suppress bogus printout during new 035_standby_logical_decoding.pl test. Our convention for some time has been that successful tests shouldn't print anything on stderr. A stray "diag" call violated that, and for that matter messed up the normal TAP progress display. Branch -- master

Re: pgsql: Try to unbreak MSVC builds for fuzzystrmatch

2023-04-08 Thread Tom Lane
Andrew Dunstan writes: > Try to unbreak MSVC builds for fuzzystrmatch > Commit a290378a37 neglrected to add a recipe for MSVC to build the > daitch_motokoff.h file. Oh! Thank you. I'd even made a mental note yesterday "what about MSVC" and then forgot it by the time I'd finished reviewing

pgsql: Skip \password TAP test on old IPC::Run versions

2023-04-08 Thread Daniel Gustafsson
Skip \password TAP test on old IPC::Run versions IPC::Run versions prior to 0.98 cause the interactive session to time out, so SKIP the test in case these versions are detected (they are within the base requirement for our TAP tests in general). Error reported by the BF and investigation by Tom

pgsql: Try to unbreak MSVC builds for fuzzystrmatch

2023-04-08 Thread Andrew Dunstan
Try to unbreak MSVC builds for fuzzystrmatch Commit a290378a37 neglrected to add a recipe for MSVC to build the daitch_motokoff.h file. Per buildfarm animal bowerbird. Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/0e9b271890c09ecb60b08e45d377031b2385ebeb

pgsql: Revert "Add support for Kerberos credential delegation"

2023-04-08 Thread Stephen Frost
Revert "Add support for Kerberos credential delegation" This reverts commit 3d4fa227bce4294ce1cc214b4a9d3b7caa3f0454. Per discussion and buildfarm, this depends on APIs that seem to not be available on at least one platform (NetBSD). Should be certainly possible to rework to be optional on that

pgsql: Update tsearch regex memory management.

2023-04-08 Thread Thomas Munro
Update tsearch regex memory management. Now that our regex engine uses palloc(), it's not necessary to set up a special memory context callback to free compiled regexes. The regex has no resources other than the memory that is already going to be freed in bulk. Reviewed-by: Tom Lane

pgsql: Update contrib/trgm_regexp's memory management.

2023-04-08 Thread Thomas Munro
Update contrib/trgm_regexp's memory management. While no code change was necessary for this code to keep working, we don't need to use PG_TRY()/PG_FINALLY() with explicit clean-up while working with regexes anymore. Reviewed-by: Tom Lane Discussion:

pgsql: Use MemoryContext API for regex memory management.

2023-04-08 Thread Thomas Munro
Use MemoryContext API for regex memory management. Previously, regex_t objects' memory was managed with malloc() and free() directly. Switch to palloc()-based memory management instead. Advantages: * memory used by cached regexes is now visible with MemoryContext observability tools *

pgsql: Redesign interrupt/cancel API for regex engine.

2023-04-08 Thread Thomas Munro
Redesign interrupt/cancel API for regex engine. Previously, a PostgreSQL-specific callback checked by the regex engine had a way to trigger a special error code REG_CANCEL if it detected that the next call to CHECK_FOR_INTERRUPTS() would certainly throw via ereport(). A later proposed bugfix

pgsql: Allow logical decoding on standbys

2023-04-08 Thread Andres Freund
Allow logical decoding on standbys Unsurprisingly, this requires wal_level = logical to be set on the primary and standby. The infrastructure added in 26669757b6a ensures that slots are invalidated if the primary's wal_level is lowered. Creating a slot on a standby waits for a xl_running_xact

pgsql: TAP test for logical decoding on standby

2023-04-08 Thread Andres Freund
TAP test for logical decoding on standby Author: "Drouvot, Bertrand" Author: Amit Khandekar Author: Craig Ringer (in an older version) Author: Andres Freund Reviewed-by: "Drouvot, Bertrand" Reviewed-by: Andres Freund Reviewed-by: Robert Haas Reviewed-by: Amit Kapila Reviewed-by: Fabrízio

pgsql: For cascading replication, wake physical and logical walsenders

2023-04-08 Thread Andres Freund
For cascading replication, wake physical and logical walsenders separately Physical walsenders can't send data until it's been flushed; logical walsenders can't decode and send data until it's been applied. On the standby, the WAL is flushed first, which will only wake up physical walsenders; and

pgsql: Handle logical slot conflicts on standby

2023-04-08 Thread Andres Freund
Handle logical slot conflicts on standby During WAL replay on the standby, when a conflict with a logical slot is identified, invalidate such slots. There are two sources of conflicts: 1) Using the information added in 6af1793954e, logical slots are invalidated if required rows are removed 2)