Re: Synchronizing slots from primary to standby

2023-12-07 Thread Peter Smith
Hi. Here are my review comments for patch v43-0002. == Commit message 1. The nap time of worker is tuned according to the activity on the primary. The worker starts with nap time of 10ms and if no activity is observed on the primary for some time, then nap time is increased to 10sec. And if

Re: Wrong results with grouping sets

2023-12-07 Thread Richard Guo
On Mon, Sep 25, 2023 at 3:11 PM Richard Guo wrote: > If the grouping expression is a Var or PHV, we can just set its > nullingrels, very straightforward. For an expression that is neither a > Var nor a PHV, I'm not quite sure how to set the nullingrels. I tried > the idea of wrapping it in a n

Re: remaining sql/json patches

2023-12-07 Thread Peter Eisentraut
Here are a couple of small patches to tidy up the parser a bit in your v28-0004 (JSON_TABLE) patch. It's not a lot; the rest looks okay to me. (I don't have an opinion on the concurrent discussion on resolving some precedence issues.) From 0dc7e7852702272f0bf12aaa4b56b9ac60c4d969 Mon Sep 17 00

Re: Something seems weird inside tts_virtual_copyslot()

2023-12-07 Thread David Rowley
On Fri, 1 Dec 2023 at 14:30, David Rowley wrote: > > On Fri, 1 Dec 2023 at 13:14, Andres Freund wrote: > > So I think adding an assert to ExecCopySlot(), perhaps with a comment saying > > that the restriction could be lifted with a bit of work, would be fine. > > How about the attached? I wrote

Re: Make COPY format extendable: Extract COPY TO format implementations

2023-12-07 Thread Junwang Zhao
On Thu, Dec 7, 2023 at 8:39 AM Michael Paquier wrote: > > On Wed, Dec 06, 2023 at 10:07:51PM +0800, Junwang Zhao wrote: > > I read the thread[1] you posted and I think Andres's suggestion sounds > > great. > > > > Should we extract both *copy to* and *copy from* for the first step, in that > > ca

Re: Test 002_pg_upgrade fails with olddump on Windows

2023-12-07 Thread Michael Paquier
On Wed, Dec 06, 2023 at 11:00:01AM +0300, Alexander Lakhin wrote: > So it looks like >     my $newregresssrc = "$srcdir/src/test/regress"; > is incorrect for meson. > Maybe it should be?: >     my $newregresssrc = dirname($ENV{REGRESS_SHLIB}); > (With this line the test passes for me on Windows and

Re: Make COPY format extendable: Extract COPY TO format implementations

2023-12-07 Thread Junwang Zhao
On Thu, Dec 7, 2023 at 1:05 PM Sutou Kouhei wrote: > > Hi, > > In > "Re: Make COPY format extendable: Extract COPY TO format implementations" > on Wed, 6 Dec 2023 22:07:51 +0800, > Junwang Zhao wrote: > > > Should we extract both *copy to* and *copy from* for the first step, in that > > cas

Re: postgres_fdw test timeouts

2023-12-07 Thread Alexander Lakhin
Hello Thomas, 03.12.2023 09:00, Thomas Munro wrote: On Sun, Dec 3, 2023 at 6:00 PM Alexander Lakhin wrote: I've managed to reproduce the failure locally when running postgres_fdw_x/ regress in parallel (--num-processes 10). It reproduced for me on on 04a09ee94 (iterations 1, 2, 4), but not on

Re: Synchronizing slots from primary to standby

2023-12-07 Thread shveta malik
On Thu, Dec 7, 2023 at 1:19 PM Drouvot, Bertrand wrote: > > Hi, > > On 12/6/23 11:58 AM, shveta malik wrote: > > On Wed, Dec 6, 2023 at 3:00 PM Drouvot, Bertrand > > wrote: > >> > >> Hi, > >> > >> On 12/6/23 7:18 AM, shveta malik wrote: > >>> On Wed, Dec 6, 2023 at 10:56 AM Amit Kapila > >>> wr

Re: Synchronizing slots from primary to standby

2023-12-07 Thread Drouvot, Bertrand
Hi, On 12/7/23 10:07 AM, shveta malik wrote: On Thu, Dec 7, 2023 at 1:19 PM Drouvot, Bertrand wrote: Might be worth to add comments in the code (around the WalRcv->latestWalEnd checks) that no "lagging" sync are possible if the walreceiver is not started though? I am a bit confused. Do you

Configure problem when cross-compiling PostgreSQL 16.1

2023-12-07 Thread Dominik Michael Rauh
Hi all, I was trying to cross-compile PostgreSQL 16.1 using Buildroot which worked fine until I executed "initdb" on my target device, where I faced the following error: 2023-12-06 07:10:18.568 UTC [31] FATAL: could not load library "/usr/lib/postgresql/dict_snowball.so": /usr/lib/postgresql/

Re: backtrace_on_internal_error

2023-12-07 Thread Peter Eisentraut
On 05.12.23 11:55, Peter Eisentraut wrote: I think the implementation would be very simple, something like diff --git a/src/backend/utils/error/elog.c b/src/backend/utils/error/elog.c index 6aeb855e49..45d40abe92 100644 --- a/src/backend/utils/error/elog.c +++ b/src/backend/utils/error/elog.c

Re: Proposal to add page headers to SLRU pages

2023-12-07 Thread Andrey M. Borodin
Hi Yong! +1 to the idea to protect SLRUs from corruption. I'm slightly leaning towards the idea of separating checksums from data pages, but anyway this checksums are better than no checksums. > On 7 Dec 2023, at 10:06, Li, Yong wrote: > > I am still working on patching the pg_upgrade. Just

Re: Reducing output size of nodeToString

2023-12-07 Thread Peter Eisentraut
On 06.12.23 22:08, Matthias van de Meent wrote: PFA a patch that reduces the output size of nodeToString by 50%+ in most cases (measured on pg_rewrite), which on my system reduces the total size of pg_rewrite by 33% to 472KiB. This does keep the textual pg_node_tree format alive, but reduces its

Re: Improve WALRead() to suck data directly from WAL buffers when possible

2023-12-07 Thread Bharath Rupireddy
On Mon, Nov 13, 2023 at 7:02 PM Bharath Rupireddy wrote: > > On Fri, Nov 10, 2023 at 2:28 AM Andres Freund wrote: > > > I think the code needs to make sure that *never* happens. That seems > > unrelated > > to holding or not holding WALBufMappingLock. Even if the page header is > > already valid

Re: remaining sql/json patches

2023-12-07 Thread Erik Rijkers
my interspersed bash echoing - seemed best to leave it in. (I'm using patch; should be all right, no? Am I doing it wrong?) -- [2023.12.07 11:29:39 json_table2] patch 1 of 5 (json_table2) [/home/aardvark/download/pgpatches/0170/json_table/20231207/v29-0001-Add-soft-error-handling-to-some-exp

Re: remaining sql/json patches

2023-12-07 Thread jian he
two JsonCoercionState in src/tools/pgindent/typedefs.list. +JsonCoercionState JsonConstructorExpr JsonConstructorExprState JsonConstructorType JsonEncoding +JsonExpr +JsonExprOp +JsonExprPostEvalState +JsonExprState +JsonCoercionState + post_eval->jump_eval_coercion = jsestate->jump_eval_resu

Re: Transaction timeout

2023-12-07 Thread 邱宇航
Hi, I read the V6 patch and found something needs to be improved. Prepared transactions should also be documented. A value of zero (the default) disables the timeout. +This timeout is not applied to prepared transactions. Only transactions +with user connections are affec

Re: remaining sql/json patches

2023-12-07 Thread Alvaro Herrera
On 2023-Dec-07, Erik Rijkers wrote: > Hm, this set doesn't apply for me. 0003 gives error, see below (sorrty for > my interspersed bash echoing - seemed best to leave it in. > (I'm using patch; should be all right, no? Am I doing it wrong?) There's definitely something wrong with the patch file;

Removing const-false IS NULL quals and redundant IS NOT NULL quals

2023-12-07 Thread David Rowley
(Moving discussion from -bugs [1] to -hackers for more visibility.) Background: This started out as a performance fix for bug #17540 but has now extended beyond that as fixing that only requires we don't add redundant IS NOT NULL quals to Min/Max aggregate rewrites. The attached gets rid of all I

Reduce useless changes before reassembly during logical replication

2023-12-07 Thread li jie
Hi hackers, During logical replication, if there is a large write transaction, some spill files will be written to disk, depending on the setting of logical_decoding_work_mem. This behavior can effectively avoid OOM, but if the transaction generates a lot of change before commit, a large number o

Re: pg_upgrade and logical replication

2023-12-07 Thread vignesh C
On Tue, 5 Dec 2023 at 10:56, Michael Paquier wrote: > > On Mon, Dec 04, 2023 at 04:30:49PM +0530, Amit Kapila wrote: > > I have made minor changes in the comments and code at various places. > > See and let me know if you are not happy with the changes. I think > > unless there are more suggestion

Re: Reducing output size of nodeToString

2023-12-07 Thread Matthias van de Meent
On Thu, 7 Dec 2023 at 11:26, Peter Eisentraut wrote: > > On 06.12.23 22:08, Matthias van de Meent wrote: > > PFA a patch that reduces the output size of nodeToString by 50%+ in > > most cases (measured on pg_rewrite), which on my system reduces the > > total size of pg_rewrite by 33% to 472KiB. Th

Re: Is WAL_DEBUG related code still relevant today?

2023-12-07 Thread Bharath Rupireddy
On Mon, Dec 4, 2023 at 12:37 AM Noah Misch wrote: > > On Sun, Dec 03, 2023 at 08:30:24PM +0530, Bharath Rupireddy wrote: > > On Sun, Dec 3, 2023 at 4:00 AM Nathan Bossart > > wrote: > > > On Sat, Dec 02, 2023 at 07:36:29PM +0530, Bharath Rupireddy wrote: > > > > b) Remove both the WAL_DEBUG macr

Re: pg_upgrade and logical replication

2023-12-07 Thread vignesh C
On Thu, 7 Dec 2023 at 07:20, Masahiko Sawada wrote: > > On Mon, Dec 4, 2023 at 8:01 PM Amit Kapila wrote: > > > > On Fri, Dec 1, 2023 at 11:24 PM vignesh C wrote: > > > > > > The attached v22 version patch has the changes for the same. > > > > > > > I have made minor changes in the comments and

Re: Remove MSVC scripts from the tree

2023-12-07 Thread Alvaro Herrera
On 2023-Dec-07, Peter Eisentraut wrote: > On 06.12.23 21:52, Andrew Dunstan wrote: > > Yes, if I comment out the call to structfunc() the test passes on VS2017 > > (compiler version 19.15.26726) > > This is strange, because we use code like that in the tree. There must be > some small detail th

Re: Synchronizing slots from primary to standby

2023-12-07 Thread Amit Kapila
On Wed, Dec 6, 2023 at 4:53 PM shveta malik wrote: > > v43-001: > 1) Support of 'failover' dump in pg_dump. It was missing earlier. > Review v43-0001 1. + * However, we do not enable failover for slots created by the table sync + * worker. This is because the table sync slot mig

Re: Forbid the use of invalidated physical slots in streaming replication.

2023-12-07 Thread Ashutosh Bapat
On Wed, Dec 6, 2023 at 6:25 PM Zhijie Hou (Fujitsu) wrote: > > Hi, > > When testing streaming replication with a physical slot. I found an unexpected > behavior that the walsender could use an invalidated physical slot for > streaming. > > This occurs when the primary slot is invalidated due to re

Re: Is WAL_DEBUG related code still relevant today?

2023-12-07 Thread Bharath Rupireddy
On Thu, Dec 7, 2023 at 8:10 AM Michael Paquier wrote: > > On Wed, Dec 06, 2023 at 11:32:19PM -0300, Euler Taveira wrote: > > IIUC trace_recovery_messages was a debugging aid in the 9.0 era when the HS > > was > > introduced. I'm also wondering if anyone used it in the past years. > > FWIW, I'd be

Re: Reducing output size of nodeToString

2023-12-07 Thread David Rowley
On Thu, 7 Dec 2023 at 10:09, Matthias van de Meent wrote: > PFA a patch that reduces the output size of nodeToString by 50%+ in > most cases (measured on pg_rewrite), which on my system reduces the > total size of pg_rewrite by 33% to 472KiB. This does keep the textual > pg_node_tree format alive,

Re: remaining sql/json patches

2023-12-07 Thread Amit Langote
On Thu, Dec 7, 2023 at 7:39 PM jian he wrote: > based on: > json_behavior_clause_opt: > json_behavior ON EMPTY_P > { $$ = list_make2($1, NULL); } > | json_behavior ON ERROR_P > { $$ = list_make2(NULL, $1); } > | json_behavior ON EMPTY_P json_behavior ON ERROR_P > { $$ = list_make2($1, $4); } > | /

Re: Emitting JSON to file using COPY TO

2023-12-07 Thread Joe Conway
On 12/6/23 21:56, Nathan Bossart wrote: On Wed, Dec 06, 2023 at 03:20:46PM -0500, Tom Lane wrote: If Nathan's perf results hold up elsewhere, it seems like some micro-optimization around the text-pushing (appendStringInfoString) might be more useful than caching. The 7% spent in cache lookups c

Re: Transaction timeout

2023-12-07 Thread Andrey M. Borodin
Thanks Yuhang!On 7 Dec 2023, at 13:39, 邱宇航 wrote:I read the V6 patch and found something needs to be improved.Fixed. PFA v7.Best regards, Andrey Borodin. v7-0001-Introduce-transaction_timeout.patch Description: Binary data

Re: Transaction timeout

2023-12-07 Thread Andrey M. Borodin
> On 7 Dec 2023, at 06:25, Japin Li wrote: > > If idle_in_transaction_timeout is bigger than transaction_timeout, > the idle-in-transaction timeout don't needed, right? Yes, I think so. > >> TODO: as Yuhang pointed out prepared transactions must not be killed, thus >> name "transaction_time

Re: Memory consumed by paths during partitionwise join planning

2023-12-07 Thread David Rowley
On Fri, 1 Dec 2023 at 19:59, Ashutosh Bapat wrote: > I am fine to work on this further if the community thinks it is > acceptable. It seems from your point of view the worth of this work is > as follows > a. memory savings - not worth it > b. getting rid of !IsA(old_path, IndexPath) - worth it > c

RE: Forbid the use of invalidated physical slots in streaming replication.

2023-12-07 Thread Zhijie Hou (Fujitsu)
On Thursday, December 7, 2023 7:43 PM Ashutosh Bapat wrote: Hi, > > On Wed, Dec 6, 2023 at 6:25 PM Zhijie Hou (Fujitsu) > wrote: > > > > When testing streaming replication with a physical slot. I found an > > unexpected behavior that the walsender could use an invalidated > > physical slot fo

Re: Emitting JSON to file using COPY TO

2023-12-07 Thread Andrew Dunstan
On 2023-12-06 We 17:56, David G. Johnston wrote: On Wed, Dec 6, 2023 at 3:38 PM Joe Conway wrote: So the questions are: 1. Do those two formats work for the initial implementation? Yes.  We provide a stream-oriented format and one atomic-import format. 2. Is the default correct

Re: Emitting JSON to file using COPY TO

2023-12-07 Thread Daniel Verite
Joe Conway wrote: > The attached should fix the CopyOut response to say one column. I.e. it > ought to look something like: Spending more time with the doc I came to the opinion that in this bit of the protocol, in CopyOutResponse (B) ... Int16 The number of columns in the data to be cop

Re: Emitting JSON to file using COPY TO

2023-12-07 Thread David G. Johnston
On Thursday, December 7, 2023, Daniel Verite wrote: > Joe Conway wrote: > > > The attached should fix the CopyOut response to say one column. I.e. it > > ought to look something like: > > Spending more time with the doc I came to the opinion that in this bit > of the protocol, in CopyOutR

Re: initdb caching during tests

2023-12-07 Thread Matthias van de Meent
On Fri, 25 Aug 2023 at 00:16, Andres Freund wrote: > > Hi, > > On 2023-08-23 10:10:31 +0200, Daniel Gustafsson wrote: > > > On 23 Aug 2023, at 03:17, Andres Freund wrote: > > > On 2023-08-22 23:47:24 +0200, Daniel Gustafsson wrote: > > > > >> My only small gripe is that I keep thinking about temp

Re: Emitting JSON to file using COPY TO

2023-12-07 Thread Joe Conway
On 12/7/23 08:35, Daniel Verite wrote: Joe Conway wrote: The attached should fix the CopyOut response to say one column. I.e. it ought to look something like: Spending more time with the doc I came to the opinion that in this bit of the protocol, in CopyOutResponse (B) ... Int16 The n

Re: Emitting JSON to file using COPY TO

2023-12-07 Thread Joe Conway
On 12/7/23 08:52, Joe Conway wrote: Or maybe this is preferred? 8<-- [{"ss":{"f1":1,"f2":1}}, {"ss":{"f1":1,"f2":2}}, {"ss":{"f1":1,"f2":3}}] 8<-- I don't know why my mail client keeps adding extra spaces, but the intention here is a single space in front

Re: pg_upgrade failing for 200+ million Large Objects

2023-12-07 Thread Kumar, Sachin
> I have updated the patch to use heuristic, During pg_upgrade we count > Large objects per database. During pg_restore execution if db large_objects > count is greater than LARGE_OBJECTS_THRESOLD (1k) we will use > --restore-blob-batch-size. I think both SECTION_DATA and SECTION_POST_DATA can

Re: initdb caching during tests

2023-12-07 Thread Daniel Gustafsson
> On 7 Dec 2023, at 14:50, Matthias van de Meent > wrote: > Attached a patch that fixes this for both make and meson, by adding > --no-clean to the initdb template. Makes sense. While in there I think we should rename -N to the long optoin --no-sync to make it easier to grep for and make the b

Re: Emitting JSON to file using COPY TO

2023-12-07 Thread David G. Johnston
On Thursday, December 7, 2023, Joe Conway wrote: > On 12/7/23 08:35, Daniel Verite wrote: > >> Joe Conway wrote: >> >> The attached should fix the CopyOut response to say one column. I.e. it >>> ought to look something like: >>> >> >> Spending more time with the doc I came to the opinion

Re: Proposal to add page headers to SLRU pages

2023-12-07 Thread Aleksander Alekseev
Hi, > +1 to the idea to protect SLRUs from corruption. I'm slightly leaning towards > the idea of separating checksums from data pages, but anyway this checksums > are better than no checksums. > > On 7 Dec 2023, at 10:06, Li, Yong wrote: > > I am still working on patching the pg_upgrade. Just

Re: Configure problem when cross-compiling PostgreSQL 16.1

2023-12-07 Thread Tom Lane
Dominik Michael Rauh writes: > Apparently when cross-compiling the linker is automatically assumed to not > understand "--export-dynamic", leading to aforementioned problem on my end. > ... > There is also at least one additional linker flag "--as-needed" that is not > being used when cross-compil

Re: backtrace_on_internal_error

2023-12-07 Thread Tom Lane
Peter Eisentraut writes: > Something else to note: I wrote the above code to check the error code; > it doesn't check whether the original code write elog() or ereport(). > There are some internal errors that are written as ereport() now. > Others might be changed from time to time; until now

Re: initdb caching during tests

2023-12-07 Thread Matthias van de Meent
On Thu, 7 Dec 2023 at 15:06, Daniel Gustafsson wrote: > > > On 7 Dec 2023, at 14:50, Matthias van de Meent > > wrote: > > > Attached a patch that fixes this for both make and meson, by adding > > --no-clean to the initdb template. > > Makes sense. While in there I think we should rename -N to t

I’ve come across what I think is a bug

2023-12-07 Thread John Scalia
In the documentation, Under CREATE PUBLICATION under parameters publish (string) This parameter determines which DML operations will be published by the new publication to the subscribers. The value is comma-separated list of operations. The default is to publish all a

Re: trying again to get incremental backup

2023-12-07 Thread Jakub Wartak
On Tue, Dec 5, 2023 at 7:11 PM Robert Haas wrote: [..v13 patchset] The results with v13 patchset are following: * - requires checkpoint on primary when doing incremental on standby when it's too idle, this was explained by Robert in [1], something AKA too-fast-incremental backup due to testing-

Re: [CAUTION!! freemail] Re: Partial aggregates pushdown

2023-12-07 Thread Robert Haas
On Wed, Dec 6, 2023 at 7:11 PM fujii.y...@df.mitsubishielectric.co.jp wrote: > I would be grateful if we can resolve this issue gradually. I would also like > to continue the discussion if possible in the future. I think that would be good. Thanks for your work on this. It is a hard problem. --

Re: UBSan pointer overflow in xlogreader.c

2023-12-07 Thread Robert Haas
On Tue, Dec 5, 2023 at 4:01 PM Nathan Bossart wrote: > +1 So, Thomas ... any chance you could commit this? So that my patch stops making cfbot sad? -- Robert Haas EDB: http://www.enterprisedb.com

Re: Emitting JSON to file using COPY TO

2023-12-07 Thread Joe Conway
On 12/7/23 09:11, David G. Johnston wrote: Those are all the same breakage though - if truly interpreted as data rows the protocol is basically written such that the array format is not supportable and only the lines format can be used.  Hence my “format 0 doesn’t work” comment for array output

Re: I’ve come across what I think is a bug

2023-12-07 Thread Euler Taveira
On Thu, Dec 7, 2023, at 11:39 AM, John Scalia wrote: > In the documentation, Under CREATE PUBLICATION under parameters > > publish (string) > This parameter determines which DML operations will be > published by the new publication to the subscribers. The value is > co

Re: trying again to get incremental backup

2023-12-07 Thread Robert Haas
On Thu, Dec 7, 2023 at 9:42 AM Jakub Wartak wrote: > Comment: I was wondering if it wouldn't make some sense to teach > pg_resetwal to actually delete all WAL summaries after any any > WAL/controlfile alteration? I thought that this was a good idea so I decided to go implement it, only to dis

Re: Is WAL_DEBUG related code still relevant today?

2023-12-07 Thread Robert Haas
On Thu, Dec 7, 2023 at 6:20 AM Bharath Rupireddy wrote: > I'm just curious to know what sorts of problems WAL_DEBUG code helps > debug with. Is the WAL_DEBUG code (1) or (2) or (3) that helped you > the most? Is converting the LOG messages (3) to DEBUGX level going to > help in your case? Can you

Re: Is WAL_DEBUG related code still relevant today?

2023-12-07 Thread Noah Misch
On Thu, Dec 07, 2023 at 04:50:30PM +0530, Bharath Rupireddy wrote: > On Mon, Dec 4, 2023 at 12:37 AM Noah Misch wrote: > > On Sun, Dec 03, 2023 at 08:30:24PM +0530, Bharath Rupireddy wrote: > > > On Sun, Dec 3, 2023 at 4:00 AM Nathan Bossart > > > wrote: > > > > On Sat, Dec 02, 2023 at 07:36:29P

Re: Make COPY format extendable: Extract COPY TO format implementations

2023-12-07 Thread Andrew Dunstan
On 2023-12-07 Th 03:37, Junwang Zhao wrote: The point of this refactor (from my view) is to make it possible to add new copy handlers in extensions, just like access method. As Andres suggested, a system catalog like *pg_copy_handler*, if we split TO and FROM into two sets of routines, does th

Re: Building PosgresSQL with LLVM fails on Solaris 11.4

2023-12-07 Thread Andres Freund
Hi, On 2023-12-07 13:43:55 +, Sacha Hottinger wrote: > Thanks a lot. > It now got much further but failed here with Sun Studio: > … > gmake[2]: Leaving directory > '/opt/cnd/opt28-2_13.3_gmake_all_llvm_fixV2/src/test/perl' > gmake -C backend/jit/llvm all > gmake[2]: Entering directory > '/op

Re: Remove MSVC scripts from the tree

2023-12-07 Thread Andres Freund
Hi, On 2023-12-04 15:11:47 -0500, Andrew Dunstan wrote: > I just had a look at shifting bowerbird to use meson, and it got stymied at > the c99 test, which apparently doesn't compile with anything less than > VS2019. What error or warning is being raised by msvc? Andres

Re: remaining sql/json patches

2023-12-07 Thread Robert Haas
On Wed, Dec 6, 2023 at 10:26 AM Alvaro Herrera wrote: > > I think I'm inclined toward adapting the LA-token fix (attached 0005), > > because we've done that before with SQL/JSON constructors patch. > > Also, if I understand the concerns that Tom mentioned at [1] > > correctly, maybe we'd be better

Re: Proposal to add page headers to SLRU pages

2023-12-07 Thread Andrey Borodin
07.12.2023, 19:17, "Aleksander Alekseev" :Hi, +1 to the idea to protect SLRUs from corruption. I'm slightly leaning towards the idea of separating checksums from data pages, but anyway this checksums are better than no checksums. On 7 Dec 2023, at 10:06, Li, Yong wrote: I am still w

Re: Remove MSVC scripts from the tree

2023-12-07 Thread Andres Freund
Hi, On 2023-12-07 12:33:35 +0100, Alvaro Herrera wrote: > Well, We have things like these > > typedef struct _archiveOpts > { > ... > } ArchiveOpts; > #define ARCHIVE_OPTS(...) &(ArchiveOpts){__VA_ARGS__} > > XL_ROUTINE is quite similar. > > These are then used like >

errors building on windows using meson

2023-12-07 Thread Dave Cramer
Greetings, Getting the following error: state-exec: run failed: cannot create new executor meta: cannot get matching bin by path: no matching binary by path "C:\\Users\\Administrator\\AppData\\Local\\activestate\\cache\\b9117b06\\exec\\perl.EXE" state-exec: Not user serviceable; Please contact su

Re: Proposal to add page headers to SLRU pages

2023-12-07 Thread Debnath, Shawn
>> Sounds like a half-measure to me. If we really want to go down this >> rabbit hole IMO SLRU should be moved to shared buffers as proposed >> elsewhere [1]. > Thread that I cited stopped in 2018 for this exact reason. 5 years ago. Is > this argument still valid? Meanwhile checksums of buffer p

Re: remaining sql/json patches

2023-12-07 Thread Alvaro Herrera
I noticed that JSON_TABLE uses an explicit FORMAT JSON in one of the rules, instead of using json_format_clause_opt like everywhere else. I wondered why, and noticed that it's because it wants to set coltype JTC_FORMATTED when the clause is present but JTC_REGULAR otherwise. This seemed a little o

Re: Remove MSVC scripts from the tree

2023-12-07 Thread Andrew Dunstan
On 2023-12-07 Th 12:34, Andres Freund wrote: Hi, On 2023-12-07 12:33:35 +0100, Alvaro Herrera wrote: Well, We have things like these typedef struct _archiveOpts { ... } ArchiveOpts; #define ARCHIVE_OPTS(...) &(ArchiveOpts){__VA_ARGS__} XL_ROUTINE is quite similar. These are then us

Re: errors building on windows using meson

2023-12-07 Thread Andres Freund
Hi, On 2023-12-07 12:54:27 -0500, Dave Cramer wrote: > state-exec: run failed: cannot create new executor meta: cannot get > matching bin by path: no matching binary by path > "C:\\Users\\Administrator\\AppData\\Local\\activestate\\cache\\b9117b06\\exec\\perl.EXE" > state-exec: Not user serviceabl

Re: Remove MSVC scripts from the tree

2023-12-07 Thread Andres Freund
Hi, On 2023-12-07 13:49:44 -0500, Andrew Dunstan wrote: > On 2023-12-07 Th 12:34, Andres Freund wrote: > > However: I used godbolt to compile the test code on msvc, and it seems to > > build with 19.15 (which is the version Andrew referenced upthread), with a > > warning that's triggered independe

Re: errors building on windows using meson

2023-12-07 Thread Dave Cramer
On Thu, 7 Dec 2023 at 13:53, Andres Freund wrote: > Hi, > > On 2023-12-07 12:54:27 -0500, Dave Cramer wrote: > > state-exec: run failed: cannot create new executor meta: cannot get > > matching bin by path: no matching binary by path > > > "C:\\Users\\Administrator\\AppData\\Local\\activestate\\c

Re: Make COPY format extendable: Extract COPY TO format implementations

2023-12-07 Thread Masahiko Sawada
On Fri, Dec 8, 2023 at 1:39 AM Andrew Dunstan wrote: > > > On 2023-12-07 Th 03:37, Junwang Zhao wrote: > > > > The point of this refactor (from my view) is to make it possible to add new > > copy handlers in extensions, just like access method. As Andres suggested, > > a system catalog like *pg_co

Re: errors building on windows using meson

2023-12-07 Thread Andres Freund
Hi, On 2023-12-07 14:16:52 -0500, Dave Cramer wrote: > On Thu, 7 Dec 2023 at 13:53, Andres Freund wrote: > > > Hi, > > > > On 2023-12-07 12:54:27 -0500, Dave Cramer wrote: > > > state-exec: run failed: cannot create new executor meta: cannot get > > > matching bin by path: no matching binary by

Re: Proposal to add page headers to SLRU pages

2023-12-07 Thread Robert Haas
On Thu, Dec 7, 2023 at 1:28 PM Debnath, Shawn wrote: > What is being proposed now is the simple and core functionality of introducing > page headers to SLRU pages while continuing to be in the SLRU cache. This > allows the whole project to be iterative and reviewers to better reason about > the sm

Re: Remove MSVC scripts from the tree

2023-12-07 Thread Thomas Munro
On Thu, Dec 7, 2023 at 5:27 AM Andrew Dunstan wrote: > But the VS2019 compiler implements enough of C99 to pass our meson test, > unlike VS2017. Maybe the test is too strict. After all, we know we can > in fact build with the earlier versions. . o O { I wish master would systematically drop suppo

Improve upcasting for INT range and multi range types

2023-12-07 Thread Federico
Hi, Postgresql seems to be missing upcasting when doing INT range and multi-range operation, for example when checking if an int4 is inside an int8 range. Some non working example are the following SELECT 2::INT4 <@ '[1, 4)'::INT8RANGE -- ERROR: operator does not exist: integer <@ int8ran

Re: CREATE FUNCTION ... SEARCH { DEFAULT | SYSTEM | SESSION }

2023-12-07 Thread Jeff Davis
On Tue, 2023-11-21 at 09:24 -0500, Robert Haas wrote: > As to the first, could we > remove the setjmp() and instead have abort-time processing know > something about this? For example, imagine we just push something > onto > a stack like we do for ErrorContextCallback, do whatever, and then > pop >

Re: errors building on windows using meson

2023-12-07 Thread Dave Cramer
On Thu, 7 Dec 2023 at 14:34, Andres Freund wrote: > Hi, > > On 2023-12-07 14:16:52 -0500, Dave Cramer wrote: > > On Thu, 7 Dec 2023 at 13:53, Andres Freund wrote: > > > > > Hi, > > > > > > On 2023-12-07 12:54:27 -0500, Dave Cramer wrote: > > > > state-exec: run failed: cannot create new executor

Re: postgres_fdw test timeouts

2023-12-07 Thread Thomas Munro
On Thu, Dec 7, 2023 at 10:00 PM Alexander Lakhin wrote: > I think, I've found out what's going on here. > The culprit is WSAEnumNetworkEvents() assisted by non-trivial logic of > ExecAppendAsyncEventWait(). > For the case noccurred > 1, ExecAppendAsyncEventWait() performs a loop, > where ExecAsync

Re: [CAUTION!! freemail] Re: Partial aggregates pushdown

2023-12-07 Thread Bruce Momjian
On Thu, Dec 7, 2023 at 09:56:08AM -0500, Robert Haas wrote: > On Wed, Dec 6, 2023 at 7:11 PM fujii.y...@df.mitsubishielectric.co.jp > wrote: > > I would be grateful if we can resolve this issue gradually. I would also > > like to continue the discussion if possible in the future. > > I think th

Re: CREATE FUNCTION ... SEARCH { DEFAULT | SYSTEM | SESSION }

2023-12-07 Thread Jeff Davis
On Tue, 2023-12-05 at 11:58 -0800, Jeff Davis wrote: > Also, I forward-declared config_generic in guc.h to eliminate the > cast. Looking more closely, I fixed an issue related to placeholder configs. We can't return a handle to a placeholder, because it's not stable, so in that case it falls back

Re: Synchronizing slots from primary to standby

2023-12-07 Thread Peter Smith
Hi. Here is another review comment for the patch v43-0001. == src/bin/pg_dump/pg_dump.c 1. getSubscriptions + if (fout->remoteVersion >= 17) + appendPQExpBufferStr(query, + " subfailoverstate\n"); + else + appendPQExpBuffer(query, + " '%c' AS subfailoverstate\n", + LOGICALREP_FAILOV

Re: postgres_fdw test timeouts

2023-12-07 Thread Nathan Bossart
On Fri, Dec 08, 2023 at 09:55:58AM +1300, Thomas Munro wrote: > Oh, wow. Nice detective work! Thank you for figuring that out. +1 > Now we have the question of whether to go forwards (commit the "socket > table" thing), or backwards (revert 04a09ee for now to clear the CI > failures). I don't

micro-optimizing json.c

2023-12-07 Thread Nathan Bossart
Moving this to a new thread... On Thu, Dec 07, 2023 at 07:15:28AM -0500, Joe Conway wrote: > On 12/6/23 21:56, Nathan Bossart wrote: >> On Wed, Dec 06, 2023 at 03:20:46PM -0500, Tom Lane wrote: >> > If Nathan's perf results hold up elsewhere, it seems like some >> > micro-optimization around the t

Re: micro-optimizing json.c

2023-12-07 Thread Jeff Davis
On Thu, 2023-12-07 at 17:12 -0600, Nathan Bossart wrote: > Here's a patch that removes a couple of strlen() calls that showed up > prominently in perf for a COPY TO (FORMAT json) on 110M integers.  On > my > laptop, I see a 20% speedup from ~23.6s to ~18.9s for this test. Nice improvement. The use

Re: Improve WALRead() to suck data directly from WAL buffers when possible

2023-12-07 Thread Jeff Davis
On Thu, 2023-12-07 at 15:59 +0530, Bharath Rupireddy wrote: > In the attached v17 patch 0001 could impact performance could be impacted in a few ways: * There's one additional write barrier inside AdvanceXLInsertBuffer() * AdvanceXLInsertBuffer() already holds WALBufMappingLock, so

Re: micro-optimizing json.c

2023-12-07 Thread Tom Lane
Jeff Davis writes: > Nice improvement. The use of (len = ...) in a conditional is slightly > out of the ordinary, but it makes the conditionals a bit simpler and > you have a comment, so it's fine with me. Yeah. It's a little not per project style, but I don't see a nice way to do it differently

Re: [HACKERS] pg_upgrade vs vacuum_cost_delay

2023-12-07 Thread Bruce Momjian
On Fri, Nov 24, 2023 at 06:20:28PM +0100, Magnus Hagander wrote: > On Fri, Nov 24, 2023 at 5:34 PM Bruce Momjian wrote: > > > > On Fri, Nov 24, 2023 at 01:10:01PM +0100, Michael Banck wrote: > > > Hi, > > > > > > On Fri, Nov 24, 2023 at 12:17:56PM +0100, Magnus Hagander wrote: > > > > On Fri, Nov

Re: Test 002_pg_upgrade fails with olddump on Windows

2023-12-07 Thread Michael Paquier
On Thu, Dec 07, 2023 at 05:44:53PM +0900, Michael Paquier wrote: > Hmm. Yes, it looks like you're right here. That should allow all the > scenarios we expect to work to update the paths for the functions. And done this one as well down to v15, where not only meson, but also vpath could have been

Re: [PoC] Improve dead tuple storage for lazy vacuum

2023-12-07 Thread Masahiko Sawada
On Wed, Dec 6, 2023 at 3:39 PM John Naylor wrote: > > On Wed, Dec 6, 2023 at 4:34 AM Masahiko Sawada wrote: > > > > On Mon, Dec 4, 2023 at 5:21 PM John Naylor wrote: > > > > > Given variable-length value support, RT_GET() would have to do > > > > repalloc() if the existing value size is not big

Re: [PoC] Improve dead tuple storage for lazy vacuum

2023-12-07 Thread Masahiko Sawada
On Thu, Dec 7, 2023 at 12:27 PM John Naylor wrote: > > On Mon, Nov 27, 2023 at 1:45 PM Masahiko Sawada wrote: > > > > On Sat, Oct 28, 2023 at 5:56 PM John Naylor wrote: > > > bool > > RT_SET(RT_RADIX_TREE *tree, uint64 key, RT_VALUE_TYPE *value_p); > > or for variable-length value support, > > R

Re: Make COPY format extendable: Extract COPY TO format implementations

2023-12-07 Thread Junwang Zhao
On Fri, Dec 8, 2023 at 3:27 AM Masahiko Sawada wrote: > > On Fri, Dec 8, 2023 at 1:39 AM Andrew Dunstan wrote: > > > > > > On 2023-12-07 Th 03:37, Junwang Zhao wrote: > > > > > > The point of this refactor (from my view) is to make it possible to add > > > new > > > copy handlers in extensions,

Re: [HACKERS] psql casts aspersions on server reliability

2023-12-07 Thread Bruce Momjian
On Fri, Nov 24, 2023 at 10:19:29AM -0500, Bruce Momjian wrote: > On Fri, Nov 24, 2023 at 04:06:22AM +0100, Laurenz Albe wrote: > > On Thu, 2023-11-23 at 11:12 -0500, Bruce Momjian wrote: > > > On Wed, Nov 22, 2023 at 10:25:14PM -0500, Bruce Momjian wrote: > > > > Yes, you are correct. Here is a pa

Re: Synchronizing slots from primary to standby

2023-12-07 Thread shveta malik
On Thu, Dec 7, 2023 at 2:57 PM Drouvot, Bertrand wrote: > > Hi, > > On 12/7/23 10:07 AM, shveta malik wrote: > > On Thu, Dec 7, 2023 at 1:19 PM Drouvot, Bertrand > > wrote: > >> Might be worth to add comments in the code (around the WalRcv->latestWalEnd > >> checks) that no "lagging" sync are pos

Re: micro-optimizing json.c

2023-12-07 Thread David Rowley
On Fri, 8 Dec 2023 at 12:13, Nathan Bossart wrote: > Here's a patch that removes a couple of strlen() calls that showed up > prominently in perf for a COPY TO (FORMAT json) on 110M integers. On my > laptop, I see a 20% speedup from ~23.6s to ~18.9s for this test. + seplen = use_line_feeds ? size

Re: UBSan pointer overflow in xlogreader.c

2023-12-07 Thread Thomas Munro
On Fri, Dec 8, 2023 at 3:57 AM Robert Haas wrote: > On Tue, Dec 5, 2023 at 4:01 PM Nathan Bossart > wrote: > > +1 > > So, Thomas ... any chance you could commit this? So that my patch > stops making cfbot sad? Done. Thanks both for the reviews.

Re: micro-optimizing json.c

2023-12-07 Thread Tom Lane
David Rowley writes: > I might be neater to get rid of the if condition and have: > [ calls of appendBinaryStringInfo with len 0 ] Hmm, if we are trying to micro-optimize, I seriously doubt that that's an improvement. regards, tom lane

Re: micro-optimizing json.c

2023-12-07 Thread Nathan Bossart
On Thu, Dec 07, 2023 at 07:40:30PM -0500, Tom Lane wrote: > Hmm ... I think that might not be the way to think about it. What > I'm wondering is why we need a test as expensive as IsValidJsonNumber > in the first place, given that we know this is a numeric data type's > output. ISTM we only need

Re: micro-optimizing json.c

2023-12-07 Thread Tom Lane
Nathan Bossart writes: > I did both of these in v2, although I opted to test that the first > character after the optional '-' was a digit instead of testing that it was > _not_ an 'I' or 'N'. Yeah, I thought about that too after sending my message. This version LGTM, although maybe the comment

Re: micro-optimizing json.c

2023-12-07 Thread Nathan Bossart
On Fri, Dec 08, 2023 at 04:11:52PM +1300, David Rowley wrote: > + seplen = use_line_feeds ? sizeof(",\n ") - 1 : sizeof(",") - 1; > > Most modern compilers will be fine with just: > > seplen = strlen(sep); > > I had to go back to clang 3.4.1 and GCC 4.1.2 to see the strlen() call > with that cod

  1   2   >