Re: [BUG] Fix DETACH with FK pointing to a partitioned table fails

2024-07-17 Thread Tender Wang
Hi Alvaro, Recently, Alexander reported the same issue on [1]. And before that, another same issue was reported on [2]. So I try to re-work those issues. In my last email on this thread, I said that " I slightly modified the previous patch,but I didn't add test case, because I found another issu

Re: Removing unneeded self joins

2024-07-17 Thread Pogosyan Vardan
On 16.07.2024 21:30, Alexander Korotkov wrote: Hi, Vardan! Great, thank you! On Tue, Jul 16, 2024 at 5:26 PM Вардан Погосян wrote: I did the SJE testing at Andrey's request. To do this, I used the automatic testing tool EET (Equivalent Expression Transformation) [1] with some modifications.

Re: Built-in CTYPE provider

2024-07-17 Thread Jeff Davis
On Wed, 2024-07-17 at 15:03 -0700, Noah Misch wrote: > If I'm counting the votes right ... > , you and Tom have voted that the feature's > current state is okay, and I and Laurenz have voted that it's not > okay. ... > A tie would become a decision against the unreleased behavior. ... > In th

Re: pgsql: Add more SQL/JSON constructor functions

2024-07-17 Thread jian he
we still have problem in transformJsonBehavior currently transformJsonBehavior: SELECT JSON_VALUE(jsonb '1234', '$' RETURNING bit(3) DEFAULT 010111 ON ERROR); ERROR: cannot cast behavior expression of type text to bit LINE 1: ...VALUE(jsonb '1234', '$' RETURNING bit(3) DEFAULT 010111 ON ... he

Re: Pluggable cumulative statistics

2024-07-17 Thread Michael Paquier
On Tue, Jul 16, 2024 at 10:27:25AM +0900, Michael Paquier wrote: > Perhaps we should have a few more inline functions like > pgstat_get_entry_len() to retrieve the parts of the custom data in the > snapshot and shmem control structures for fixed-numbered stats. That > would limit what extensions n

Re: Conflict detection and logging in logical replication

2024-07-17 Thread shveta malik
On Thu, Jul 18, 2024 at 7:52 AM Zhijie Hou (Fujitsu) wrote: > > On Thursday, July 11, 2024 1:03 PM shveta malik > wrote: > > Hi, > > Thanks for the comments! > > > > > I have one concern about how we deal with conflicts. As for insert_exists, > > we > > keep on erroring out while raising confli

Re: Expand applicability of aggregate's sortop optimization

2024-07-17 Thread Andrei Lepikhov
On 17/7/2024 16:33, Matthias van de Meent wrote: On Wed, 17 Jul 2024 at 05:29, Andrei Lepikhov wrote: As I see, the code: aggsortop = fetch_agg_sort_op(aggref->aggfnoid); if (!OidIsValid(aggsortop)) return false;/* not a MIN/MAX aggregate */ used twice and can be evaluated

Re: Pgoutput not capturing the generated columns

2024-07-17 Thread Peter Smith
Hi Shubham, here are my review comments for patch v19-0001. == src/backend/replication/pgoutput/pgoutput.c 1. /* * Columns included in the publication, or NULL if all columns are * included implicitly. Note that the attnums in this bitmap are not + * publication and include_generated_c

Re: CI, macports, darwin version problems

2024-07-17 Thread Thomas Munro
On Thu, Jul 18, 2024 at 9:58 AM Joe Conway wrote: > On 7/17/24 16:41, Andres Freund wrote: > > Does "tart pull ghcr.io/cirruslabs/macos-runner:sonoma" as the CI user > > succeed? > > Yes, with about 25 GB to spare. Thanks. Now it works! But for some reason it spends several minutes in the "sche

Re: RFC: pg_stat_logmsg

2024-07-17 Thread Michael Paquier
On Wed, Jul 17, 2024 at 07:43:13AM -0400, Joe Conway wrote: > On 7/16/24 18:14, Tomas Vondra wrote: >> As for the feature, I've never done a fleet-wide analysis, so if this is >> one of the main use cases, I'm not really sure I can judge if this is a >> good tool for that. It seems like it might be

Re: Allow logical failover slots to wait on synchronous replication

2024-07-17 Thread shveta malik
On Thu, Jul 18, 2024 at 9:25 AM shveta malik wrote: > > On Tue, Jul 9, 2024 at 12:42 AM John H wrote: > > > > > > > Can we make it a default > > > behavior that logical slots marked with a failover option will wait > > > for 'synchronous_standby_names' as per your patch's idea unless > > > 'stand

Re: RFC: pg_stat_logmsg

2024-07-17 Thread Michael Paquier
On Wed, Jul 17, 2024 at 07:48:15AM -0400, Joe Conway wrote: > I think including version in the key makes most sense. Also do we even have > a mechanism to grab the commit sha in running code? Not directly, still that's doable. The closest thing I would consider here is to get the output of someth

Re: improve performance of pg_dump with many sequences

2024-07-17 Thread Tom Lane
Nathan Bossart writes: > Here is an attempt at adding a new function that returns the sequence tuple > and using that to avoid querying each sequence relation individually in > dumpSequenceData(). Didn't read the patch yet, but ... > If we instead wanted to change pg_sequence_last_value() to ret

Re: Allow logical failover slots to wait on synchronous replication

2024-07-17 Thread shveta malik
On Tue, Jul 9, 2024 at 12:42 AM John H wrote: > > > > Can we make it a default > > behavior that logical slots marked with a failover option will wait > > for 'synchronous_standby_names' as per your patch's idea unless > > 'standby_slot_names' is specified? I don't know if there is any value > > i

Re: improve performance of pg_dump with many sequences

2024-07-17 Thread Nathan Bossart
Here is an attempt at adding a new function that returns the sequence tuple and using that to avoid querying each sequence relation individually in dumpSequenceData(). If we instead wanted to change pg_sequence_last_value() to return both is_called and last_value, I think we could modify the pg_se

Re: SQL:2011 application time

2024-07-17 Thread Paul Jungwirth
On 7/9/24 00:15, jian he wrote: **Option 2**: Add a new operator, called &&&, that works like && except an empty range *does* overlap another empty range. Empty ranges should still not overlap anything else. This would fix the exclusion constraint. You could add `(5, 'empty')` once but not twic

RE: Slow catchup of 2PC (twophase) transactions on replica in LR

2024-07-17 Thread Zhijie Hou (Fujitsu)
On Thursday, July 18, 2024 10:11 AM Kuroda, Hayato/黒田 隼人 wrote: > > Dear Peter, > > Thanks for giving comments! PSA new version. I did a few more tests and analysis and didn't find issues. Just share the cases I tested: 1. After manually rolling back xacts for two_pc and switch two_pc option

Re: Redundant code in create_gather_merge_path

2024-07-17 Thread Richard Guo
On Thu, Jul 18, 2024 at 10:02 AM Richard Guo wrote: > I noticed this while reviewing patch [1], thinking that it might be > worth fixing. Any thoughts? Here is the patch. Thanks Richard v1-0001-Remove-redundant-code-in-create_gather_merge_path.patch Description: Binary data

Re: speed up a logical replica setup

2024-07-17 Thread Amit Kapila
On Wed, Jul 17, 2024 at 5:28 PM Hayato Kuroda (Fujitsu) wrote: > > > Your analysis sounds correct to me. > > Okay, so we could have a same picture... > > > > IIUC, the root cause is that pg_create_logical_replication_slot() returns > > > a LSN > > > which is not generated yet. So, I think both mi

RE: Slow catchup of 2PC (twophase) transactions on replica in LR

2024-07-17 Thread Hayato Kuroda (Fujitsu)
Dear Peter, Thanks for giving comments! PSA new version. I think most of comments were addressed, and I ran pgindent/pgperltidy again. Regarding the CheckAlterSubOption(), the ordering is still preserved because I preferred to keep some specs. But I can agree that yours make codes simpler. BTW,

Redundant code in create_gather_merge_path

2024-07-17 Thread Richard Guo
In create_gather_merge_path, we should always guarantee that the subpath is adequately ordered, and we do not add a Sort node in createplan.c for a Gather Merge node. Therefore, the 'else' branch in the snippet from create_gather_merge_path is redundant. if (pathkeys_contained_in(pathkeys, su

Re: Remove dependence on integer wrapping

2024-07-17 Thread jian he
On Wed, Jul 17, 2024 at 9:23 AM Joseph Koshakow wrote: > > Updated in the attached patch. > > Once again, the other patches, 0001, 0003, and 0004 are unchanged but > have their version number incremented. > +-- Test for overflow in array slicing +CREATE temp table arroverflowtest (i int[]); +INS

Re: Wrong results with grouping sets

2024-07-17 Thread Richard Guo
On Thu, Jul 18, 2024 at 8:31 AM Richard Guo wrote: > I am confused. Does the SQL standard explicitly define or standardize > the behavior of grouping by volatile expressions? Does anyone know > about that? Just for the record, multiple instances of non-volatile grouping expressions should alway

Re: [EXTERNAL] Re: Add non-blocking version of PQcancel

2024-07-17 Thread Thomas Munro
On Thu, Jul 18, 2024 at 7:00 AM Alexander Lakhin wrote: > As far as I can see (having analyzed a number of runs), the hanging occurs > when some itimer-related activity happens before "peek_socket" in this > event sequence: > [main] postgres {pid} select_stuff::wait: res after verify 0 > [main] po

Re: Injection points: preloading and runtime arguments

2024-07-17 Thread Michael Paquier
On Wed, Jul 17, 2024 at 11:19:41AM +0900, Michael Paquier wrote: > It works for me to do as you are proposing at the end, that could > always be changed if there are more arguments in favor of a different > behavior that plays more with the shmem data. I have taken some time this morning and appli

Re: Remove dependence on integer wrapping

2024-07-17 Thread Joseph Koshakow
On Tue, Jul 16, 2024 at 11:17 PM Nathan Bossart wrote: > I've attached an editorialized version of 0002 based on my thoughts above. Looks great, thanks! Thanks, Joe Koshakow

Re: Wrong results with grouping sets

2024-07-17 Thread Richard Guo
On Wed, Jul 17, 2024 at 8:50 AM Paul George wrote: > > Since a subquery is a volatile expression, each of its instances > should be evaluated separately. I don't think this conclusion is correct. Look at: select random(), random() from t group by random(); random | random ---

Re: Slow catchup of 2PC (twophase) transactions on replica in LR

2024-07-17 Thread Peter Smith
Hi Kuroda-San, here are some review comment for patch v19-1 == doc/src/sgml/ref/alter_subscription.sgml The previous patches have common failover/two_phase code checking for "Do not allow changing the option if the subscription is enabled", but it seems the docs were mentioning that only

Re: Slow catchup of 2PC (twophase) transactions on replica in LR

2024-07-17 Thread Peter Smith
Hi, here are my review comments for patch v19-0002. == src/backend/commands/subscriptioncmds.c CheckAlterSubOption: nitpick - tweak some comment wording ~ On Wed, Jul 17, 2024 at 3:13 PM Hayato Kuroda (Fujitsu) wrote: > > > 1c. > > If the error checks can be moved to be done up-front, then

Re: Proposal for implementing OCSP Stapling in PostgreSQL

2024-07-17 Thread David Zhang
= Design = It looks like this design relies on the DBA to manually prefetch OCSP responses for their cert chain, and cache them in the local ssl_ocsp_file. This is similar to Nginx's ssl_stapling_file directive [1]. I think this may make sense for a v1 (much less code!), but it's going to take a

Add mention of execution time memory for enable_partitionwise_* GUCs

2024-07-17 Thread David Rowley
Over on [1], there's a complaint about a query OOMing because the use of enable_partitionwise_aggregate caused a plan with 1000 Hash Aggregate nodes. The only mention in the docs is the additional memory requirements and CPU for query planning when that GUC is enabled. There's no mention that exec

Re: Expand applicability of aggregate's sortop optimization

2024-07-17 Thread David Rowley
On Wed, 17 Jul 2024 at 17:12, Andrei Lepikhov wrote: > I generally like the idea of a support function. But as I can see, the > can_minmax_aggs() rejects if any of the aggregates don't pass the > checks. The prosupport feature is designed to be applied to each > function separately. How do you th

Re: Built-in CTYPE provider

2024-07-17 Thread Noah Misch
On Wed, Jul 17, 2024 at 08:48:46AM -0700, Jeff Davis wrote: > On Thu, 2024-07-11 at 05:50 -0700, Noah Misch wrote: > > > This is still marked as an open item for 17, but you've already > > > acknowledged[1] that no code changes are necessary in version 17. > > > > Later posts on the thread made th

Re: CI, macports, darwin version problems

2024-07-17 Thread Joe Conway
On 7/17/24 16:41, Andres Freund wrote: Hi, On 2024-07-17 13:20:06 -0400, Joe Conway wrote: > > Or maybe simpler -- how do people typically add storage to a mac mini? I > > don't mind buying an external disk or whatever. > > That I do not know, not a mac person at all... Well maybe unneeded?

Re: optimizing pg_upgrade's once-in-each-database steps

2024-07-17 Thread Nathan Bossart
On Wed, Jul 17, 2024 at 11:16:59PM +0200, Daniel Gustafsson wrote: > First reaction after a read-through is that this seems really cool, can't wait > to see how much v18 pg_upgrade will be over v17. I will do more testing and > review once back from vacation, below are some comments from reading w

Re: optimizing pg_upgrade's once-in-each-database steps

2024-07-17 Thread Daniel Gustafsson
> On 9 Jul 2024, at 05:33, Nathan Bossart wrote: > The code is still very rough and nowhere near committable, but this at > least gets the patch set into the editing phase. First reaction after a read-through is that this seems really cool, can't wait to see how much v18 pg_upgrade will be over

Re: Things I don't like about \du's "Attributes" column

2024-07-17 Thread Pavel Luzanov
On 16.07.2024 18:00, Robert Haas wrote: On the question of display width, my personal opinion is that the current patch is worse than what we have now. Robert, David, thanks for the detailed explanation. I tried to remember all the thoughts that led to this version of the patch. So the main

Re: CI, macports, darwin version problems

2024-07-17 Thread Andres Freund
Hi, On 2024-07-17 13:20:06 -0400, Joe Conway wrote: > > > Or maybe simpler -- how do people typically add storage to a mac mini? I > > > don't mind buying an external disk or whatever. > > > > That I do not know, not a mac person at all... > > Well maybe unneeded? Does "tart pull ghcr.io/cirrus

Re: Use read streams in CREATE DATABASE command when the strategy is wal_log

2024-07-17 Thread Noah Misch
On Wed, Jul 17, 2024 at 12:22:49PM +0300, Nazir Bilal Yavuz wrote: > On Tue, 16 Jul 2024 at 15:19, Noah Misch wrote: > > On Tue, Jul 16, 2024 at 02:11:20PM +0300, Nazir Bilal Yavuz wrote: > > > On Fri, 12 Jul 2024 at 02:52, Noah Misch wrote: > > > > On Tue, Apr 16, 2024 at 02:12:19PM +0300, Nazir

Re: POC, WIP: OR-clause support for indexes

2024-07-17 Thread Alexander Korotkov
Hi, Alena! On Wed, Jul 17, 2024 at 3:53 PM Alena Rybakina wrote: > On 17.07.2024 03:03, Alexander Korotkov wrote: > > Hi, Alena! > > > > On Thu, Jul 11, 2024 at 7:17 PM Alena Rybakina > > wrote: > >> I have finished patch and processed almost your suggestions (from [0], > [1], [2]). It remains

Re: improve performance of pg_dump with many sequences

2024-07-17 Thread Tom Lane
Nathan Bossart writes: > On Wed, Jul 17, 2024 at 02:59:26PM -0400, Tom Lane wrote: >> Uh ... why do we need a function, rather than just >> select * from pg_sequence > We can use that for dumpSequence(), but dumpSequenceData() requires > information from the sequence tuple itself. Right now, we

Re: improve performance of pg_dump with many sequences

2024-07-17 Thread Nathan Bossart
On Wed, Jul 17, 2024 at 02:59:26PM -0400, Tom Lane wrote: > Nathan Bossart writes: >> On second thought, I worry that this change might needlessly complicate the >> pg_sequences system view. Maybe we should just add a >> pg_sequence_get_tuple() function that returns everything in >> FormData_pg_s

Re: improve performance of pg_dump with many sequences

2024-07-17 Thread Tom Lane
Nathan Bossart writes: > On second thought, I worry that this change might needlessly complicate the > pg_sequences system view. Maybe we should just add a > pg_sequence_get_tuple() function that returns everything in > FormData_pg_sequence_data for a given sequence OID... Uh ... why do we need

Re: improve performance of pg_dump with many sequences

2024-07-17 Thread Nathan Bossart
On Tue, Jul 16, 2024 at 10:23:08PM -0500, Nathan Bossart wrote: > On Wed, Jul 17, 2024 at 11:30:04AM +0900, Michael Paquier wrote: >> Yeah, I have bumped on the same issue. In the long term, I also think >> that we'd better have pg_sequence_last_value() return a row with >> is_called and the value

Re: PG_TEST_EXTRA and meson

2024-07-17 Thread Tom Lane
Jacob Champion writes: > On Wed, Jul 17, 2024 at 8:01 AM Tom Lane wrote: >> The existing and documented expectation is that PG_TEST_EXTRA is an >> environment variable, ie it's a runtime option not a configure option. >> Making it be the latter seems like a significant loss of flexibility >> to m

Re: CI, macports, darwin version problems

2024-07-17 Thread Tom Lane
Andres Freund writes: > On 2024-07-16 12:12:37 -0400, Joe Conway wrote: >> Or maybe simpler -- how do people typically add storage to a mac mini? I >> don't mind buying an external disk or whatever. > That I do not know, not a mac person at all... I think USB SSD is the way at present. MacRumor

Re: CI, macports, darwin version problems

2024-07-17 Thread Joe Conway
On 7/17/24 13:01, Andres Freund wrote: On 2024-07-16 12:12:37 -0400, Joe Conway wrote: > It's possible you have some old images stored as your user, check > "tart list" for both users. Hmm, this is not the easiest ever to parse for me... Unfortunately due to the wrapping it's not easy to read

Re: problems with "Shared Memory and Semaphores" section of docs

2024-07-17 Thread Tom Lane
Nathan Bossart writes: > The only thing stopping me from committing this right now is Tom's upthread > objection about adding more GUCs that just expose values that you can't > actually set. If that objection still stands, I'll withdraw this patch > (and maybe try introducing a new way to surface

Re: CI, macports, darwin version problems

2024-07-17 Thread Andres Freund
Hi, On 2024-07-16 12:12:37 -0400, Joe Conway wrote: > > It's possible you have some old images stored as your user, check > > "tart list" for both users. > > Hmm, this is not the easiest ever to parse for me... Unfortunately due to the wrapping it's not easy to read here either... I don't think

Re: Meson far from ready on Windows

2024-07-17 Thread Andres Freund
Hi, On 2024-07-16 15:53:45 -0500, Tristan Partin wrote: > Other than that, it looks pretty solid. Thanks for looking! I'm thinking of pushing the first few patches soon-ish. I'm debating between going for 17 + HEAD or also applying it to 16, to keep the trees more similar. > Looks like we cou

Re: Vacuum ERRORs out considering freezing dead tuples from before OldestXmin

2024-07-17 Thread Melanie Plageman
On Wed, Jul 17, 2024 at 12:11 PM Peter Geoghegan wrote: > > On Wed, Jul 17, 2024 at 12:07 PM Melanie Plageman > wrote: > > We didn't end up doing two index vacuum passes. Because it doesn't > > repro locally for me, I can only assume that the conditions for > > forcing two index vacuuming passes

Re: problems with "Shared Memory and Semaphores" section of docs

2024-07-17 Thread Nathan Bossart
On Sun, Jun 09, 2024 at 02:04:17PM -0500, Nathan Bossart wrote: > Here's a new version of the patch with the GUC renamed to > num_os_semaphores. The only thing stopping me from committing this right now is Tom's upthread objection about adding more GUCs that just expose values that you can't actua

Re: Vacuum ERRORs out considering freezing dead tuples from before OldestXmin

2024-07-17 Thread Peter Geoghegan
On Wed, Jul 17, 2024 at 12:07 PM Melanie Plageman wrote: > We didn't end up doing two index vacuum passes. Because it doesn't > repro locally for me, I can only assume that the conditions for > forcing two index vacuuming passes in master just weren't met in this > case. I'm unsurprised, as it is

Re: Vacuum ERRORs out considering freezing dead tuples from before OldestXmin

2024-07-17 Thread Melanie Plageman
On Wed, Jul 17, 2024 at 11:07 AM Melanie Plageman wrote: > > On Mon, Jul 15, 2024 at 6:02 PM Peter Geoghegan wrote: > > > > I think that there is some chance that this test will break the build > > farm in whatever way, since there is a long history of VACUUM not > > quite behaving as expected wi

Re: [PATCH] Refactor pqformat.{c,h} and protocol.h

2024-07-17 Thread Nathan Bossart
On Tue, Jul 16, 2024 at 04:38:06PM -0500, Nathan Bossart wrote: > Alright. Well, I guess I'll flip a coin tomorrow unless someone else > chimes in with an opinion. Committed and back-patched to v17. I left it as PqMsg_Progress. -- nathan

Re: Built-in CTYPE provider

2024-07-17 Thread Jeff Davis
On Thu, 2024-07-11 at 05:50 -0700, Noah Misch wrote: > > This is still marked as an open item for 17, but you've already > > acknowledged[1] that no code changes are necessary in version 17. > > Later posts on the thread made that obsolete.  The next step is to > settle the > question at https://p

Re: PG_TEST_EXTRA and meson

2024-07-17 Thread Jacob Champion
On Wed, Jul 17, 2024 at 8:01 AM Tom Lane wrote: > Jacob Champion writes: > > Personally I use the config-time PG_TEST_EXTRA extensively. I'd be sad > > to see it go, especially if developers are no longer forced to use it. > > The existing and documented expectation is that PG_TEST_EXTRA is an >

Re: PG_TEST_EXTRA and meson

2024-07-17 Thread Andrew Dunstan
On 2024-07-17 We 11:01 AM, Tom Lane wrote: Jacob Champion writes: On Wed, Jul 17, 2024 at 3:34 AM Nazir Bilal Yavuz wrote: Sorry, the previous reply was wrong; I misunderstood what you said. Yes, that is how the patch was coded and I agree that getting rid of config time PG_TEST_EXTRA could

Re: Vacuum ERRORs out considering freezing dead tuples from before OldestXmin

2024-07-17 Thread Melanie Plageman
On Mon, Jul 15, 2024 at 6:02 PM Peter Geoghegan wrote: > > On Mon, Jul 8, 2024 at 2:25 PM Melanie Plageman > wrote: > > I could still use another pair of eyes on the test (looking out for > > stability enhancing measures I could take). > > First, the basics: I found that your test failed reliably

Re: PG_TEST_EXTRA and meson

2024-07-17 Thread Tom Lane
Jacob Champion writes: > On Wed, Jul 17, 2024 at 3:34 AM Nazir Bilal Yavuz wrote: >> Sorry, the previous reply was wrong; I misunderstood what you said. >> Yes, that is how the patch was coded and I agree that getting rid of >> config time PG_TEST_EXTRA could be a better alternative. > Personall

Re: Windows perl/tcl requirement documentation

2024-07-17 Thread Andrew Dunstan
On 2024-07-16 Tu 7:21 PM, Michael Paquier wrote: On Mon, Jul 01, 2024 at 11:27:26AM -0400, Andrew Dunstan wrote: Our docs currently state this regarding the perl requirement for building on Windows: ActiveState Perl ActiveState Perl is required to run the build generation scripts. M

Re: recovery test error

2024-07-17 Thread Andrew Dunstan
On 2024-07-16 Tu 7:45 PM, Michael Paquier wrote: On Tue, Jul 16, 2024 at 03:04:13PM -0400, Andrew Dunstan wrote: This was called by poll_query_until(), which is changed by the patch to use a libpq session rather than constantly forking psql. ISTM we should be passing true as a second parameter

Re: PG_TEST_EXTRA and meson

2024-07-17 Thread Jacob Champion
On Wed, Jul 17, 2024 at 3:34 AM Nazir Bilal Yavuz wrote: > Sorry, the previous reply was wrong; I misunderstood what you said. > Yes, that is how the patch was coded and I agree that getting rid of > config time PG_TEST_EXTRA could be a better alternative. Personally I use the config-time PG_TEST

Re: Expand applicability of aggregate's sortop optimization

2024-07-17 Thread Andrei Lepikhov
On 17/7/2024 16:33, Matthias van de Meent wrote: On Wed, 17 Jul 2024 at 05:29, Andrei Lepikhov wrote: Thanks for the job! I guess you could be more brave and push down also FILTER statement. While probably not impossible, I wasn't planning on changing this code with new optimizations; just ex

Re: Add a GUC check hook to ensure summarize_wal cannot be enabled when wal_level is minimal

2024-07-17 Thread Robert Haas
On Tue, Jul 16, 2024 at 1:16 PM Fujii Masao wrote: > I don't have another solution that can be pushed into v17. I understand > the risks raised so far, so I'm okay with just pushing the "fast_forward" > patch. > It might be helpful to add a note to the summarize_wal documentation, > for example,

Re: Addressing SECURITY DEFINER Function Vulnerabilities in PostgreSQL Extensions

2024-07-17 Thread Ashutosh Sharma
Hi Robert, On Tue, Jul 16, 2024 at 9:40 PM Robert Haas wrote: > > On Tue, Jul 16, 2024 at 1:55 AM Ashutosh Sharma wrote: > > Just to confirm, are you suggesting to remove the protected flag and > > set the default search_path (as $extension_schema,) for all functions > > within an extension wher

Asynchronous MergeAppend

2024-07-17 Thread Alexander Pyhalov
Hello. I'd like to make MergeAppend node Async-capable like Append node. Nowadays when planner chooses MergeAppend plan, asynchronous execution is not possible. With attached patches you can see plans like EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM async_pt WHERE b % 100 = 0 ORDER BY b, a;

Re: Add new COPY option REJECT_LIMIT

2024-07-17 Thread torikoshia
On 2024-07-03 02:07, Fujii Masao wrote: However, if we support REJECT_LIMIT, I'm not sure if the ON_ERROR option is still necessary. I remembered another reason for the necessity of ON_ERROR. ON_ERROR defines how to behave when encountering an error and it just accepts 'ignore' and 'stop' cur

Re: POC, WIP: OR-clause support for indexes

2024-07-17 Thread Alena Rybakina
Hi! Thanks for your contribution to this topic! On 17.07.2024 03:03, Alexander Korotkov wrote: Hi, Alena! On Thu, Jul 11, 2024 at 7:17 PM Alena Rybakina wrote: I have finished patch and processed almost your suggestions (from [0], [1], [2]). It remains only to add tests where the conversion

RE: speed up a logical replica setup

2024-07-17 Thread Hayato Kuroda (Fujitsu)
Dear Amit, > Your analysis sounds correct to me. Okay, so we could have a same picture... > > IIUC, the root cause is that pg_create_logical_replication_slot() returns a > > LSN > > which is not generated yet. So, I think both mine [1] and Euler's approach > > [2] > > can solve the issue. My p

Re: long-standing data loss bug in initial sync of logical replication

2024-07-17 Thread vignesh C
On Wed, 17 Jul 2024 at 11:54, Amit Kapila wrote: > > On Tue, Jul 16, 2024 at 6:54 PM vignesh C wrote: > > > > On Tue, 16 Jul 2024 at 11:59, Amit Kapila wrote: > > > > > > On Tue, Jul 16, 2024 at 9:29 AM Amit Kapila > > > wrote: > > > > > > > > One related comment: > > > > @@ -1219,8 +1219,14 @

Re: RFC: pg_stat_logmsg

2024-07-17 Thread Joe Conway
On 7/16/24 19:08, Michael Paquier wrote: On Wed, Jul 17, 2024 at 12:14:36AM +0200, Tomas Vondra wrote: I noticed this patch hasn't moved since September 2023, so I wonder what's the main blocker / what is needed to move this? + /* Location of permanent stats file (valid when database is shut d

Re: RFC: pg_stat_logmsg

2024-07-17 Thread Joe Conway
On 7/16/24 18:14, Tomas Vondra wrote: I noticed this patch hasn't moved since September 2023, so I wonder what's the main blocker / what is needed to move this? Mainly me finding time I'm afraid. As for the feature, I've never done a fleet-wide analysis, so if this is one of the main use case

Re: PG_TEST_EXTRA and meson

2024-07-17 Thread Nazir Bilal Yavuz
Hi, On Wed, 17 Jul 2024 at 13:23, Nazir Bilal Yavuz wrote: > > Hi, > > On Wed, 17 Jul 2024 at 13:13, Ashutosh Bapat > wrote: > > xid_wraparound tests are run if PG_TEST_EXTRA contains xid_wraparound > > or it is not set. Any other setting will not run xid_wraparound test. > > That's how the patc

Re: PG_TEST_EXTRA and meson

2024-07-17 Thread Nazir Bilal Yavuz
Hi, On Wed, 17 Jul 2024 at 13:13, Ashutosh Bapat wrote: > xid_wraparound tests are run if PG_TEST_EXTRA contains xid_wraparound > or it is not set. Any other setting will not run xid_wraparound test. > That's how the patch is coded but it isn't intuitive that changing > whether a test is run by d

Re: PG_TEST_EXTRA and meson

2024-07-17 Thread Ashutosh Bapat
On Wed, Jul 17, 2024 at 3:31 AM Nazir Bilal Yavuz wrote: > > Hi, > > On Wed, 17 Jul 2024 at 00:27, Jacob Champion > wrote: > > > > On Tue, Jul 16, 2024 at 2:12 PM Nazir Bilal Yavuz > > wrote: > > > > > > 2- If PG_TEST_EXTRA is set from the setup command, use it from the > > > setup command and

Re: speed up a logical replica setup

2024-07-17 Thread Amit Kapila
On Wed, Jul 17, 2024 at 1:23 PM Hayato Kuroda (Fujitsu) wrote: > > I also analyzed this failure, let me share it. Here, I think events in below > ordering were occurred. > > 1. Backend created a publication on $db2, > 2. BGWriter generated RUNNING_XACT record, then > 3. Backend created a replicati

Re: Expand applicability of aggregate's sortop optimization

2024-07-17 Thread Matthias van de Meent
On Wed, 17 Jul 2024 at 05:29, Andrei Lepikhov wrote: > > On 5/8/24 17:13, Matthias van de Meent wrote: > > As you may know, aggregates like SELECT MIN(unique1) FROM tenk1; are > > rewritten as SELECT unique1 FROM tenk1 ORDER BY unique1 USING < LIMIT > > 1; by using the optional sortop field in the

Re: query_id, pg_stat_activity, extended query protocol

2024-07-17 Thread Anthonin Bonnefoy
Hi, Wouldn't it be enough to call pgstat_report_query_id in ExecutorRun and ProcessUtility? With those changes [1], both normal statements and utility statements called through extended protocol will correctly report the query_id. -- Test utility statement with extended protocol show all \bind \g

Re: Use read streams in CREATE DATABASE command when the strategy is wal_log

2024-07-17 Thread Nazir Bilal Yavuz
Hi, On Tue, 16 Jul 2024 at 15:19, Noah Misch wrote: > > On Tue, Jul 16, 2024 at 02:11:20PM +0300, Nazir Bilal Yavuz wrote: > > On Fri, 12 Jul 2024 at 02:52, Noah Misch wrote: > > > On Tue, Apr 16, 2024 at 02:12:19PM +0300, Nazir Bilal Yavuz wrote: > > > > --- a/src/backend/storage/aio/read_strea

Re: Compress ReorderBuffer spill files using LZ4

2024-07-17 Thread Amit Kapila
On Tue, Jul 16, 2024 at 7:31 PM Tomas Vondra wrote: > > On 7/16/24 14:52, Amit Kapila wrote: > > On Tue, Jul 16, 2024 at 12:58 AM Tomas Vondra > > wrote: > >> > >> FWIW I'd expect that to be handled at the libpq level - there's already > >> a patch for that, but I haven't checked if it would hand

Re: pgsql: Add more SQL/JSON constructor functions

2024-07-17 Thread Amit Langote
On Tue, Jul 2, 2024 at 5:03 PM Amit Langote wrote: > On Tue, Jul 2, 2024 at 3:19 PM jian he wrote: > > On Mon, Jul 1, 2024 at 6:45 PM Amit Langote wrote: > > > > > > On Sun, Jun 30, 2024 at 3:56 AM Tom Lane wrote: > > > > Alvaro Herrera writes: > > > > >> +/* > > > > >> + * For domains

Re: New function normal_rand_array function to contrib/tablefunc.

2024-07-17 Thread Dean Rasheed
On Wed, 17 Jul 2024 at 07:29, Andy Fan wrote: > > It is just not clear to me how verbose the document should to be, and > where the document should be, tablefunc.sgml, the comment above the > function or the places just the code? In many cases you provides above > or below are just implementation

Re: Restrict EXPLAIN (ANALYZE) for RLS and security_barrier views

2024-07-17 Thread Laurenz Albe
On Tue, 2024-07-16 at 18:36 +0100, Dean Rasheed wrote: > On Mon, 6 May 2024 at 15:46, Laurenz Albe wrote: > > > > Currently, it is pretty easy to subvert the restrictions imposed > > by row-level security and security_barrier views. All you have to > > to is use EXPLAIN (ANALYZE) and see how man

Re: Differents execution times with gin index, prepared statement and literals.

2024-07-17 Thread Pierrick Chovelon
Hello, Thanks a lot for your clear answer. On 16/07/2024 19:54, Tomas Vondra wrote: On 7/16/24 17:43, Pierrick Chovelon wrote: ... Quite fast as well... Have you got an idea on the initial issue ? Why when using a prepared statement and a gin index the execution time "explode" ? Something to

Re: Slow catchup of 2PC (twophase) transactions on replica in LR

2024-07-17 Thread Peter Smith
Hi, here are my review comments for v19-0001. == doc/src/sgml/protocol.sgml nitpick - Now there is >1 option. /The following option is supported:/The following options are supported:/ == src/backend/access/transam/twophase.c TwoPhaseTransactionGid: nitpick - renamed parameter /gid/gid_r

RE: speed up a logical replica setup

2024-07-17 Thread Hayato Kuroda (Fujitsu)
Dear Alexander, Euler, Amit, I also analyzed this failure, let me share it. Here, I think events in below ordering were occurred. 1. Backend created a publication on $db2, 2. BGWriter generated RUNNING_XACT record, then 3. Backend created a replication slot on $db2. In this case, the recovery_ta