pgsql: Work around OAuth/EVFILT_TIMER quirk on NetBSD.

2025-02-28 Thread Thomas Munro
Work around OAuth/EVFILT_TIMER quirk on NetBSD. NetBSD's EVFILT_TIMER doesn't like zero timeouts, as introduced by commit b3f0be788. Steal the workaround from the same problem on Linux from a few lines up: round zero up to one. Do this only for NetBSD, as the other systems with the kevent() API

pgsql: Avoid including explain.h in explain_format.h and explain_dr.h

2025-02-28 Thread Robert Haas
Avoid including explain.h in explain_format.h and explain_dr.h As per a suggestion from Tom Lane, we do this by declaring "struct ExplainState" here and refer to that rather than "ExplainState". Also per Tom, CreateExplainSerializeDestReceiver was still defined in explain.h in addition to explain

Re: pgsql: Refactor COPY FROM to use format callback functions.

2025-02-28 Thread Masahiko Sawada
On Fri, Feb 28, 2025 at 3:06 PM Andrew Dunstan wrote: > > > On 2025-02-28 Fr 5:39 PM, Masahiko Sawada wrote: > > On Fri, Feb 28, 2025 at 2:16 PM Sutou Kouhei wrote: > > Hi, > > Thanks for following up the patch! > > In > "Re: pgsql: Refactor COPY FROM to use format callback functions." on Fri,

pgsql: Re-export NextCopyFromRawFields() to copy.h.

2025-02-28 Thread Masahiko Sawada
Re-export NextCopyFromRawFields() to copy.h. Commit 7717f630069 removed NextCopyFromRawFields() from copy.h. While it was hoped that NextCopyFrom() could serve as an alternative, certain use cases still require NextCopyFromRawFields(). For instance, extensions like file_text_array_fdw, which proce

Re: pgsql: Refactor COPY FROM to use format callback functions.

2025-02-28 Thread Masahiko Sawada
On Fri, Feb 28, 2025 at 2:16 PM Sutou Kouhei wrote: > > Hi, > > Thanks for following up the patch! > > In > "Re: pgsql: Refactor COPY FROM to use format callback functions." on Fri, > 28 Feb 2025 12:56:19 -0800, > Masahiko Sawada wrote: > > > Right. I've attached the updated patch. > > In g

Re: pgsql: Refactor COPY FROM to use format callback functions.

2025-02-28 Thread Andrew Dunstan
On 2025-02-28 Fr 5:39 PM, Masahiko Sawada wrote: On Fri, Feb 28, 2025 at 2:16 PM Sutou Kouhei wrote: Hi, Thanks for following up the patch! In "Re: pgsql: Refactor COPY FROM to use format callback functions." on Fri, 28 Feb 2025 12:56:19 -0800, Masahiko Sawada wrote: Right. I've atta

Re: pgsql: Refactor COPY FROM to use format callback functions.

2025-02-28 Thread Sutou Kouhei
Hi, Thanks for following up the patch! In "Re: pgsql: Refactor COPY FROM to use format callback functions." on Fri, 28 Feb 2025 12:56:19 -0800, Masahiko Sawada wrote: > Right. I've attached the updated patch. In general, this approach will work but could you keep the same signature for b

pgsql: Adjust auto_explain's GUC descriptions.

2025-02-28 Thread Nathan Bossart
Adjust auto_explain's GUC descriptions. This commit adjusts auto_explain's GUC descriptions to follow the style guidelines established by commit 977d865c36. Specifically, it ensures the accepted special values are listed in a consistent manner. Author: Ilia Evdokimov Reviewed-by: Peter Smith D

Re: pgsql: Trial fix for old cross-version upgrades.

2025-02-28 Thread Sami Imseih
> > > > Just noting here that \s{1} is simply the same as /s Correct. But I do like the explicitness of it though. — Sami >

pgsql: Tweak regex to avoid a bug in Perl 5.16.3.

2025-02-28 Thread Tom Lane
Tweak regex to avoid a bug in Perl 5.16.3. For some reason, 5.16.3 (and perhaps slightly earlier/later versions) go into an infinite loop with the version-replacement regex installed by commit fc0d0ce97. We can work around that by using an explicit "\n" instead of the line-start metacharacter "^"

Re: pgsql: Refactor COPY FROM to use format callback functions.

2025-02-28 Thread Andrew Dunstan
On 2025-02-28 Fr 2:55 PM, Masahiko Sawada wrote: On Fri, Feb 28, 2025 at 11:47 AM Andrew Dunstan wrote: On 2025-02-28 Fr 1:31 PM, Masahiko Sawada wrote: Refactor COPY FROM to use format callback functions. This commit introduces a new CopyFromRoutine struct, which is a set of callback rout

Re: pgsql: Trial fix for old cross-version upgrades.

2025-02-28 Thread Andrew Dunstan
On 2025-02-28 Fr 2:29 PM, Sami Imseih wrote: My perl expertise is bit shallow, but I could not find much regarding bugs related to such behavior, or maybe I did not look enough. Playing around with this, "s+", "s{1,}", s{2,}" all of these combinations where we are searching for more than 1 spa

Re: pgsql: Refactor COPY FROM to use format callback functions.

2025-02-28 Thread Andrew Dunstan
On 2025-02-28 Fr 1:31 PM, Masahiko Sawada wrote: Refactor COPY FROM to use format callback functions. This commit introduces a new CopyFromRoutine struct, which is a set of callback routines to read tuples in a specific format. It also makes COPY FROM with the existing formats (text, CSV, and b

Re: pgsql: Refactor COPY FROM to use format callback functions.

2025-02-28 Thread Masahiko Sawada
On Fri, Feb 28, 2025 at 11:47 AM Andrew Dunstan wrote: > > > On 2025-02-28 Fr 1:31 PM, Masahiko Sawada wrote: > > Refactor COPY FROM to use format callback functions. > > This commit introduces a new CopyFromRoutine struct, which is a set of > callback routines to read tuples in a specific format.

Re: pgsql: Trial fix for old cross-version upgrades.

2025-02-28 Thread Sami Imseih
I was running "make check-world" this morning on a machine that has an old version of perl, 5.16, and the check-world was hung on /usr/bin/perl t/002_pg_upgrade.pl. I never saw "make check-world" hang on this old version of perl, but I bisected the regression to this commit fc0d0ce978752493, the s

Re: pgsql: Trial fix for old cross-version upgrades.

2025-02-28 Thread Tom Lane
Sami Imseih writes: > repro'd. I don't want to attach the file here, but I added a cp > to get the dump file somewhere local Thanks for the tips about an efficient repro. I installed 5.16.3 locally using perlbrew and was able to duplicate the problem. After a bit of fooling around I found that u

Re: pgsql: Trial fix for old cross-version upgrades.

2025-02-28 Thread Sami Imseih
My perl expertise is bit shallow, but I could not find much regarding bugs related to such behavior, or maybe I did not look enough. Playing around with this, "s+", "s{1,}", s{2,}" all of these combinations where we are searching for more than 1 space result in the hanging command, but we really o

pgsql: Refactor COPY FROM to use format callback functions.

2025-02-28 Thread Masahiko Sawada
Refactor COPY FROM to use format callback functions. This commit introduces a new CopyFromRoutine struct, which is a set of callback routines to read tuples in a specific format. It also makes COPY FROM with the existing formats (text, CSV, and binary) utilize these format callbacks. This change

Re: pgsql: Trial fix for old cross-version upgrades.

2025-02-28 Thread Sami Imseih
> I also tested the same regexp expression in isolation > and I could not repro the issue. Will try a real dumpfile next. > repro'd. I don't want to attach the file here, but I added a cp to get the dump file somewhere local +++ b/src/bin/pg_upgrade/t/002_pg_upgrade.pl @@ -326,10 +326,12 @@ $oldn

Re: pgsql: Trial fix for old cross-version upgrades.

2025-02-28 Thread Sami Imseih
> 5.16 is still supported according to our install instructions, > so let's see if we can adjust that regex so it works with 5.16. > The first thing I'd try is > > - $dump =~ s {(^\s+'version',) '\d+'::integer,$} > + $dump =~ s {^(\s+'version',) '\d+'::integer,$} > With the diff below,

pgsql: Fix missing space in EXPLAIN ANALYZE output.

2025-02-28 Thread Robert Haas
Fix missing space in EXPLAIN ANALYZE output. Commit ddb17e387aa28d61521227377b00f997756b8a27 introduced this regression. Ideally, the regression tests would have caught this mistake, but apparently they don't test with timing enabled, presumably because that would make the output vary. Author: Th

Re: pgsql: Trial fix for old cross-version upgrades.

2025-02-28 Thread Tom Lane
Sami Imseih writes: > I was running "make check-world" this morning on a machine that has an > old version of perl, 5.16, and the check-world was hung on > /usr/bin/perl t/002_pg_upgrade.pl. Interesting! > and specifically, the process hangs with this specific change. > - $dump =~ s ['ver

pgsql: pg_upgrade: Fix inconsistency in memory freeing

2025-02-28 Thread Michael Paquier
pg_upgrade: Fix inconsistency in memory freeing The function in charge of freeing the memory from a result created by PQescapeIdentifier() has to be PQfreemem(), to ensure that both allocation and free come from libpq. One spot in pg_upgrade was not respecting that for pg_database's datlocale (da