Re: pgbench: allow to exit immediately when any client is aborted

2023-08-04 Thread Tatsuo Ishii
> Hi, > > I would like to propose to add an option to pgbench so that benchmark > can quit immediately when any client is aborted. Currently, when a > client is aborted due to some error, for example, network trouble, > other clients continue their run until a certain number of transactions >

Re: Is RecoveryConflictInterrupt() entirely safe in a signal handler?

2023-08-04 Thread Thomas Munro
On Sat, Aug 5, 2023 at 1:39 PM Thomas Munro wrote: > Here is a rebase over 26669757, which introduced > PROCSIG_RECOVERY_CONFLICT_LOGICALSLOT. Oops, please disregard v7 (somehow lost a precious line of code). V8 is better. From 6544931e533aa015f39215f9c9d2df3e06700a96 Mon Sep 17 00:00:00 2001

Re: A failure in 031_recovery_conflict.pl on Debian/s390x

2023-08-04 Thread Thomas Munro
On Sat, Aug 5, 2023 at 12:43 AM Christoph Berg wrote: > I managed to reproduce it on the shell by running the test in a loop a > few times. The failure looks like this: It's great that you can reproduce this semi-reliably! I've rebased the patch, hoping you can try it out.

Re: Is RecoveryConflictInterrupt() entirely safe in a signal handler?

2023-08-04 Thread Thomas Munro
Here is a rebase over 26669757, which introduced PROCSIG_RECOVERY_CONFLICT_LOGICALSLOT. I got a bit confused about why this new conflict reason didn't follow the usual ERROR->FATAL promotion rules and pinged Andres who provided: "Logical decoding slots are only acquired while performing logical

Re: Use of additional index columns in rows filtering

2023-08-04 Thread Peter Geoghegan
On Fri, Aug 4, 2023 at 4:34 PM Tomas Vondra wrote: > Thanks for the clarification, I think I understand better now. Honestly, it's gratifying to be understood at all in a discussion like this one. Figuring out how to articulate some of my more subtle ideas (without leaving out important nuances)

Re: Use of additional index columns in rows filtering

2023-08-04 Thread Tomas Vondra
On 8/4/23 04:07, Peter Geoghegan wrote: > On Thu, Aug 3, 2023 at 3:04 PM Tomas Vondra > wrote: >> Because my patch is all about reducing the heap pages, which are usually >> the expensive part of the index scan. But you're right the "index scan" >> with index filter may access more index pages,

Re: Extract numeric filed in JSONB more effectively

2023-08-04 Thread Chapman Flack
On 2023-08-03 23:55, Andy Fan wrote: > The double quotes look weird to me. but it looks like a common > situation. > > select numeric('1'::int); -- failed. > select "numeric"('1'::int); -- ok. It arises when you have an object (type, function, cast, whatever) whose name in the catalog is the

Re: Parent/child context relation in pg_get_backend_memory_contexts()

2023-08-04 Thread Melih Mutlu
Hi hackers, Melih Mutlu , 16 Haz 2023 Cum, 17:03 tarihinde şunu yazdı: > With this change, here's a query to find how much space used by each > context including its children: > > > WITH RECURSIVE cte AS ( > > SELECT id, total_bytes, id as root, name as root_name > > FROM

Re: cataloguing NOT NULL constraints

2023-08-04 Thread Alvaro Herrera
On 2023-Jul-28, Alvaro Herrera wrote: > To avoid that, one option would be to make this NN constraint > undroppable ... but I don't see how. One option might be to add a > pg_depend row that links the NOT NULL constraint to its PK constraint. > But this will be a strange case that occurs

Re: Use of additional index columns in rows filtering

2023-08-04 Thread Peter Geoghegan
On Fri, Aug 4, 2023 at 4:47 AM Tomas Vondra wrote: > Well, I presented multiple options, so "yes" doesn't really clarify > which of them applies. But my understanding is you meant the index pages > accesses. Sorry. Your understanding of what I must have meant before was correct -- your patch

Release 17 of the PostgreSQL Buildfarm Client

2023-08-04 Thread Andrew Dunstan
I have pushed Release 17 of the PostgreSQL Buildfarm client. Release 17 has two main features: * Modernize the way we do cross-version upgrade tests. Most of the logic for modifying instances to make them suitable for cross version upgrade testing has now been migrated to the Postgres

Re: WIP: new system catalog pg_wait_event

2023-08-04 Thread Tom Lane
"Drouvot, Bertrand" writes: > Now that fa88928470 generates automatically code and documentation > related to wait events, why not exposing the wait events description > through a system catalog relation? I think you'd be better off making this a view over a set-returning function. The nearby

"duplicated" wait events

2023-08-04 Thread Drouvot, Bertrand
Hi hackers, while working on the new system catalog pg_wait_event (see [1]) I noticed that some wait events are currently "duplicated": postgres=# select wait_event_name,count(*) from pg_wait_event group by wait_event_name having count(*) > 1; wait_event_name | count

WIP: new system catalog pg_wait_event

2023-08-04 Thread Drouvot, Bertrand
Hi hackers, Now that fa88928470 generates automatically code and documentation related to wait events, why not exposing the wait events description through a system catalog relation? (the idea has been proposed on twitter by Yves Colin [1]). I think that could be useful to: - join this new

Re: Using defines for protocol characters

2023-08-04 Thread Dave Cramer
On Fri, 4 Aug 2023 at 03:44, Alvaro Herrera wrote: > On 2023-Aug-03, Dave Cramer wrote: > > > New patch attached which uses PREPARED_SUB_COMMAND and > > PORTAL_SUB_COMMAND instead > > Hmm, I would keep the prefix in this case and make the message type a > second prefix, with the subtype last

RE: [PoC] pg_upgrade: allow to upgrade publisher node

2023-08-04 Thread Hayato Kuroda (Fujitsu)
Dear Amit, > So, we have three options here (a) As you have done in the patch, > document this limitation and request user to perform some manual steps > to drop the subscription; (b) don't allow upgrade to proceed if there > are invalid slots in the old cluster; (c) provide a new function like >

A failure in 031_recovery_conflict.pl on Debian/s390x

2023-08-04 Thread Christoph Berg
Re: Noah Misch > On Tue, Jul 25, 2023 at 01:56:41PM +0530, Bharath Rupireddy wrote: > > I've observed the following failure once in one of my Cirrus CI runs > > on Windows Server on HEAD: > > > > timed out waiting for match: (?^:User was holding shared buffer pin > > for too long) at > >

Re: Use of additional index columns in rows filtering

2023-08-04 Thread Tomas Vondra
On 8/4/23 02:08, Peter Geoghegan wrote: > On Thu, Aug 3, 2023 at 3:04 PM Tomas Vondra > wrote: >> When you say "index page accesses" do you mean accesses to index pages, >> or accesses to heap pages from the index scan? > > Yes, that's exactly what I mean. Note that that's the dominant cost >

Re: Synchronizing slots from primary to standby

2023-08-04 Thread shveta malik
On Fri, Aug 4, 2023 at 2:44 PM Drouvot, Bertrand wrote: > > Hi, > > On 7/28/23 4:39 PM, Bharath Rupireddy wrote: > > On Mon, Jul 24, 2023 at 9:00 AM Amit Kapila wrote: > >> > >>> 2. All candidate standbys will start one slot sync worker per logical > >>> slot which might not be scalable. > >> >

Re: [PoC] pg_upgrade: allow to upgrade publisher node

2023-08-04 Thread Amit Kapila
On Wed, Aug 2, 2023 at 1:43 PM Hayato Kuroda (Fujitsu) wrote: > > > 3. > > + /* > > + * Get replication slots. > > + * > > + * XXX: Which information must be extracted from old node? Currently three > > + * attributes are extracted because they are used by > > + *

Re: [RFC] Clang plugin for catching suspicious typedef casting

2023-08-04 Thread Dmitry Dolgov
> On Thu, Aug 03, 2023 at 12:23:52PM -0500, Tristan Partin wrote: > > This is the first I am learning about clang plugins. Interesting concept. > Did you give any thought to using libclang instead of a compiler plugin? I > am kind of doing similar work, but I went with libclang instead of a

Check volatile functions in ppi_clauses for memoize node

2023-08-04 Thread Richard Guo
In get_memoize_path() we have a theory about avoiding memoize node if there are volatile functions in the inner rel's target/restrict list. /* * We can't use a memoize node if there are volatile functions in the * inner rel's target list or restrict list. A cache hit could reduce the *

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

2023-08-04 Thread tender wang
Oversight the DetachPartitionFinalize() again, I found the root cause why 'r_p_id_fkey' wat not removed. DetachPartitionFinalize() call the GetParentedForeignKeyRefs() func to get tuple from pg_constraint that will be delete but failed. according to the comments, the GetParentedForeignKeyRefs()

Re: Simplify some logical replication worker type checking

2023-08-04 Thread Amit Kapila
On Wed, Aug 2, 2023 at 8:20 AM Amit Kapila wrote: > > On Tue, Aug 1, 2023 at 12:11 PM Alvaro Herrera > wrote: > > > > On 2023-Aug-01, Peter Smith wrote: > > > > > PSA a small patch making those above-suggested changes. The 'make > > > check' and TAP subscription tests are all passing OK. > > >

Re: remaining sql/json patches

2023-08-04 Thread Amit Langote
Hi, On Fri, Aug 4, 2023 at 19:01 Erik Rijkers wrote: > Op 7/21/23 om 12:33 schreef Amit Langote: > > > > Thanks for taking a look. > > > > Hi Amit, > > Is there any chance to rebase the outstanding SQL/JSON patches, (esp. > json_query)? Yes, working on it. Will post a WIP shortly. > --

Re: remaining sql/json patches

2023-08-04 Thread Erik Rijkers
Op 7/21/23 om 12:33 schreef Amit Langote: Thanks for taking a look. Hi Amit, Is there any chance to rebase the outstanding SQL/JSON patches, (esp. json_query)? Thanks! Erik Rijkers

Re: Using defines for protocol characters

2023-08-04 Thread Alvaro Herrera
On 2023-Aug-03, Dave Cramer wrote: > New patch attached which uses PREPARED_SUB_COMMAND and > PORTAL_SUB_COMMAND instead Hmm, I would keep the prefix in this case and make the message type a second prefix, with the subtype last -- PQMSG_CLOSE_PREPARED, PQMSG_DESCRIBE_PORTAL and so on. You

Re: Split index and table statistics into different types of stats

2023-08-04 Thread Drouvot, Bertrand
Hi, On 7/10/23 11:14 AM, Daniel Gustafsson wrote: On 4 Apr 2023, at 12:04, Drouvot, Bertrand wrote: On 4/3/23 11:47 PM, Gregory Stark (as CFM) wrote: On Thu, 16 Mar 2023 at 05:25, Drouvot, Bertrand wrote: My plan was to get [1] done before resuming working on the "Split index and table

Re: Synchronizing slots from primary to standby

2023-08-04 Thread Drouvot, Bertrand
Hi, On 7/28/23 4:39 PM, Bharath Rupireddy wrote: On Mon, Jul 24, 2023 at 9:00 AM Amit Kapila wrote: 2. All candidate standbys will start one slot sync worker per logical slot which might not be scalable. Yeah, that doesn't sound like a good idea but IIRC, the proposed patch is using one

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

2023-08-04 Thread tender wang
Oversight the DetachPartitionFinalize(), I found another bug below: postgres=# CREATE TABLE p ( id bigint PRIMARY KEY ) PARTITION BY list (id); CREATE TABLE postgres=# CREATE TABLE p_1 PARTITION OF p FOR VALUES IN (1); CREATE TABLE postgres=# CREATE TABLE r_1 ( postgres(# id bigint PRIMARY

Re: Memory consumed by child SpecialJoinInfo in partitionwise join planning

2023-08-04 Thread Ashutosh Bapat
On Fri, Jul 28, 2023 at 7:28 PM Ashutosh Bapat wrote: > > > > + bms_free(child_sjinfo->commute_above_l); > > + bms_free(child_sjinfo->commute_above_r); > > + bms_free(child_sjinfo->commute_below_l); > > + bms_free(child_sjinfo->commute_below_r); > > > > These four members in

Re: Adding a pg_servername() function

2023-08-04 Thread Laetitia Avrot
Le jeu. 3 août 2023 à 15:17, Christoph Moench-Tegeder a écrit : > ## Laetitia Avrot (laetitia.av...@gmail.com): > > > For my customer, their use case is to be able from an SQL client to > double > > check they're on the right host before doing things that could become a > > production

Re: Adding a LogicalRepWorker type field

2023-08-04 Thread Peter Smith
Thank you for the feedback received so far. Sorry, I have become busy lately with other work. IIUC there is a general +1 for the idea, but I still have some juggling necessary to make the functions/macros of patch 0001 acceptable to everybody. The difficulties arise from: - no function

Re: Synchronizing slots from primary to standby

2023-08-04 Thread Drouvot, Bertrand
Hi, On 7/24/23 4:32 AM, Bharath Rupireddy wrote: On Fri, Jul 21, 2023 at 5:16 PM shveta malik wrote: Here are my thoughts about this feature: Thanks for looking at it! Important considerations: 1. Does this design guarantee the row versions required by subscribers aren't removed on

Fix a comment in paraminfo_get_equal_hashops

2023-08-04 Thread Richard Guo
As stated in [1], there is a typo in the comment in paraminfo_get_equal_hashops. foreach(lc, innerrel->lateral_vars) { Node *expr = (Node *) lfirst(lc); TypeCacheEntry *typentry; /* Reject if there are any volatile functions in PHVs */ if

Re: Using defines for protocol characters

2023-08-04 Thread Tatsuo Ishii
> On Thu, 3 Aug 2023 at 16:59, Tatsuo Ishii wrote: > >> > On Thu, 3 Aug 2023 at 13:25, Tatsuo Ishii wrote: >> > >> >> > Greetings, >> >> > >> >> > Attached is a patch which introduces a file protocol.h. Instead of >> using >> >> > the actual characters everywhere in the code this patch names