Re: Forget close an open relation in ReorderBufferProcessTXN()

2021-05-30 Thread Amit Langote
On Thu, May 27, 2021 at 3:36 PM Amit Kapila wrote: > On Fri, May 21, 2021 at 1:12 PM Amit Langote wrote: > > > > Hmm, maybe get_rel_syn_entry() should explicitly set map to NULL when > > first initializing an entry. It's possible that without doing so, the > > ma

Re: generic plans and "initial" pruning

2023-01-19 Thread Amit Langote
the PartitionPruneResult business, but this will be less of a problem if we do the initial pruning at the beginning of InitPlan(), followed by locking, before doing anything else. We would have initialized the QueryDesc and the EState, but only minimally. That also keeps the PartitionPruneResult business local to the executor. Would you like me to hack up a PoC or are you already on that? -- Thanks, Amit Langote EDB: http://www.enterprisedb.com [1] https://www.postgresql.org/message-id/CA%2BHiwqG7ZruBmmih3wPsBZ4s0H2EhywrnXEduckY5Hr3fWzPWA%40mail.gmail.com

Re: generic plans and "initial" pruning

2023-01-19 Thread Amit Langote
On Fri, Jan 20, 2023 at 12:31 PM Tom Lane wrote: > Amit Langote writes: > > On Fri, Jan 20, 2023 at 4:39 AM Tom Lane wrote: > >> I had what felt like an epiphany: the whole problem arises because the > >> system is wrongly factored. We should get rid of AcquireEx

Re: generic plans and "initial" pruning

2023-01-19 Thread Amit Langote
On Fri, Jan 20, 2023 at 12:58 PM Tom Lane wrote: > Amit Langote writes: > > On Fri, Jan 20, 2023 at 12:31 PM Tom Lane wrote: > >> It might be possible to incorporate this pointer into PlannedStmt > >> instead of passing it separately. > > > Yeah, that would

wrong Append/MergeAppend elision?

2023-01-26 Thread Amit Langote
, run-time pruning doesn't kick in to prune p1, even though PartitionPruneInfo to do so has been generated. Attached find a patch to fix that. There are some expected output diffs in partition_prune suite, though they all look sane to me. Thoughts? -- Thanks, Amit Langote

Re: wrong Append/MergeAppend elision?

2023-01-26 Thread Amit Langote
On Fri, Jan 27, 2023 at 5:43 AM Tom Lane wrote: > David Rowley writes: > > On Fri, 27 Jan 2023 at 01:30, Amit Langote wrote: > >> It seems that the planner currently elides an Append/MergeAppend that > >> has run-time pruning info (part_prune_index) set, but

Re: Speed up transaction completion faster after many relations are accessed in a transaction

2023-01-31 Thread Amit Langote
ent resource owner. * * If the caller knows what those locks are, it can pass them as an array. * That speeds up the call significantly, when a lot of locks are held * (e.g pg_dump with a large schema). Otherwise, pass NULL for locallocks, * and we'll traverse through our ha

Re: generic plans and "initial" pruning

2023-02-02 Thread Amit Langote
On Fri, Jan 27, 2023 at 4:01 PM Amit Langote wrote: > On Fri, Jan 20, 2023 at 12:52 PM Amit Langote wrote: > > Alright, I'll try to get something out early next week. Thanks for > > all the pointers. > > Sorry for the delay. Attached is what I've come up with s

Re: generic plans and "initial" pruning

2023-02-03 Thread Amit Langote
On Thu, Feb 2, 2023 at 11:49 PM Amit Langote wrote: > On Fri, Jan 27, 2023 at 4:01 PM Amit Langote wrote: > > I didn't actually go with calling the plancache on every lock taken on > > a relation, that is, in ExecGetRangeTableRelation(). One thing about > > doing it th

Re: generic plans and "initial" pruning

2023-02-08 Thread Amit Langote
On Tue, Feb 7, 2023 at 23:38 Andres Freund wrote: > Hi, > > On 2023-02-03 22:01:09 +0900, Amit Langote wrote: > > I've added a test case under src/modules/delay_execution by adding a > > new ExecutorStart_hook that works similarly as > > delay_execution_planner(

Re: A bug with ExecCheckPermissions

2023-02-08 Thread Amit Langote
e children RTEs, for example. Also, it doesn’t make much sense to reinstate the original loop over range table and fetch the RTEPermissionInfo for the RTEs with non-0 perminfoindex, because the main goal of the patch was to make ExecCheckPermissions() independent of range table length. > -- Thanks, Amit Langote EDB: http://www.enterprisedb.com

Re: A bug with ExecCheckPermissions

2023-02-09 Thread Amit Langote
Hi, On Thu, Feb 9, 2023 at 14:44 Sergey Shinderuk wrote: > On 08.02.2023 21:23, Alvaro Herrera wrote: > > On 2023-Feb-08, Amit Langote wrote: > > > >> On Wed, Feb 8, 2023 at 16:19 Alvaro Herrera > wrote: > > > >>> I think we should a

Re: ExecRTCheckPerms() and many prunable partitions (sqlsmith)

2023-02-13 Thread Amit Langote
On Mon, Feb 13, 2023 at 5:07 Justin Pryzby wrote: > On Tue, Nov 29, 2022 at 10:37:56PM +0900, Amit Langote wrote: > > 0002 contains changes that has to do with changing how we access > > checkAsUser in some foreign table planning/execution code sites. > > Thought it might

Re: ExecRTCheckPerms() and many prunable partitions (sqlsmith)

2023-02-13 Thread Amit Langote
On Mon, Feb 13, 2023 at 22:31 Tom Lane wrote: > Amit Langote writes: > > On Mon, Feb 13, 2023 at 5:07 Justin Pryzby wrote: > >> That seems to add various elog()s which are hit frequently by sqlsmith: > > > Thanks for the report. I’ll take a look once I’m back at a

Re: ExecRTCheckPerms() and many prunable partitions (checkAsUser)

2023-02-19 Thread Amit Langote
On Fri, Feb 17, 2023 at 9:02 PM Alvaro Herrera wrote: > On 2022-Dec-11, Amit Langote wrote: > > While staring at the build_simple_rel() bit mentioned above, I > > realized that this code fails to set userid correctly in the > > inheritance parent rels that are child relatio

Re: SQL/JSON revisited

2023-02-20 Thread Amit Langote
On Tue, Feb 21, 2023 at 12:09 PM Amit Langote wrote: > On Mon, Feb 20, 2023 at 11:41 PM Erik Rijkers wrote: > > Op 20-02-2023 om 08:35 schreef Amit Langote: > > > Rebased again over queryjumble overhaul. > > But the following statement is a problem. It does not crash b

Re: ExecRTCheckPerms() and many prunable partitions (checkAsUser)

2023-02-20 Thread Amit Langote
On Tue, Feb 21, 2023 at 12:40 AM Tom Lane wrote: > Alvaro Herrera writes: > > On 2023-Feb-20, Amit Langote wrote: > >> One more thing we could try is come up with a postgres_fdw test case, > >> because it uses the RelOptInfo.userid value for remote-costs-based >

Re: Eliminating SPI from RI triggers - take 2

2022-09-28 Thread Amit Langote
On Thu, Aug 4, 2022 at 1:05 PM Amit Langote wrote: > On Wed, Jul 13, 2022 at 8:59 PM Amit Langote wrote: > > That bit came in to make DETACH CONCURRENTLY produce sane answers for > > RI queries in some cases. > > > > I guess my comment should really have said s

Re: Eliminating SPI from RI triggers - take 2

2022-09-29 Thread Amit Langote
On Thu, Sep 29, 2022 at 1:46 PM Amit Langote wrote: > Sorry about the delay. > > So I came up with such a patch that is attached as 0003. > > The main problem I want to fix with it is the need for RI_FKey_check() > to "force"-push the latest snapshot that the Partitio

Re: Eliminating SPI from RI triggers - take 2

2022-09-29 Thread Amit Langote
On Thu, Sep 29, 2022 at 4:43 PM Amit Langote wrote: > On Thu, Sep 29, 2022 at 1:46 PM Amit Langote wrote: > > Sorry about the delay. > > > > So I came up with such a patch that is attached as 0003. > > > > The main problem I want to fix with it is the need for RI

Re: Eliminating SPI from RI triggers - take 2

2022-09-29 Thread Amit Langote
On Thu, Sep 29, 2022 at 6:09 PM Amit Langote wrote: > On Thu, Sep 29, 2022 at 4:43 PM Amit Langote wrote: > > On Thu, Sep 29, 2022 at 1:46 PM Amit Langote > > wrote: > > > Sorry about the delay. > > > > > > So I came up with such a patch that is attach

Re: ExecRTCheckPerms() and many prunable partitions

2022-10-03 Thread Amit Langote
tly into ResultRelInfos. That way, anyplace in the executor that needs to look at extraUpdatedCols of a given result relation can get that from its ResultRelInfo, rather than from the RangeTblEntry as now. Thoughts? -- Thanks, Amit Langote EDB: http://www.enterprisedb.com

Re: ExecRTCheckPerms() and many prunable partitions

2022-10-03 Thread Amit Langote
On Tue, Oct 4, 2022 at 12:54 PM Tom Lane wrote: > Amit Langote writes: > > On Thu, Jul 28, 2022 at 6:18 AM Tom Lane wrote: > >> ... One more thing: maybe we should rethink where to put > >> extraUpdatedCols. Between the facts that it's not used for > >>

Re: Eliminating SPI from RI triggers - take 2

2022-10-07 Thread Amit Langote
On Sun, Oct 2, 2022 at 10:24 AM Andres Freund wrote: > On 2022-10-01 18:21:15 -0700, Andres Freund wrote: > > On 2022-09-29 18:18:10 +0900, Amit Langote wrote: > > > So, here's a final revision for today. Sorry for the noise. > > > > This appears to fail on 3

Re: Eliminating SPI from RI triggers - take 2

2022-10-07 Thread Amit Langote
On Fri, Oct 7, 2022 at 6:26 PM Amit Langote wrote: > On Sun, Oct 2, 2022 at 10:24 AM Andres Freund wrote: > > On 2022-10-01 18:21:15 -0700, Andres Freund wrote: > > > On 2022-09-29 18:18:10 +0900, Amit Langote wrote: > > > > So, here's a final revis

Re: Eliminating SPI from RI triggers - take 2

2022-10-07 Thread Amit Langote
On Fri, Oct 7, 2022 at 19:15 Alvaro Herrera wrote: > On 2022-Oct-07, Amit Langote wrote: > > > > Thanks for the heads up. Hmm, this I am not sure how to reproduce on > > > my own, so I am currently left with second-guessing what may be going > > > wrong on 32 b

Re: Eliminating SPI from RI triggers - take 2

2022-10-11 Thread Amit Langote
On Fri, Oct 7, 2022 at 7:17 PM Amit Langote wrote: > On Fri, Oct 7, 2022 at 19:15 Alvaro Herrera wrote: >> On 2022-Oct-07, Amit Langote wrote: >> > > Thanks for the heads up. Hmm, this I am not sure how to reproduce on >> > > my own, so I am currently left with

Fix obsolete reference to ExecCreatePartitionPruneState

2022-10-12 Thread Amit Langote
Robert pointed out in [1] that ExecCreatePartitionPruneState() that was renamed to CreatePartitionPruneState() in 297daa9d4353 is still referenced in src/test/modules/delay_execution/specs/partition-addition.spec. Please find attached a patch to fix that. -- Thanks, Amit Langote EDB: http

Re: ExecRTCheckPerms() and many prunable partitions

2022-10-13 Thread Amit Langote
On Wed, Oct 12, 2022 at 10:50 PM Peter Eisentraut wrote: > On 06.10.22 15:29, Amit Langote wrote: > > I tried in the attached 0004. ModifyTable gets a new member > > extraUpdatedColsBitmaps, which is List of Bitmapset "nodes". > > > > Actually, List of Bitma

Re: Eliminating SPI from RI triggers - take 2

2022-10-14 Thread Amit Langote
On Wed, Oct 12, 2022 at 2:27 AM Robert Haas wrote: > > On Thu, Sep 29, 2022 at 12:47 AM Amit Langote wrote: > > [ patches ] > > While looking over this thread I came across this code: Thanks for looking. > /* For data reading, executor always omits detached partition

Re: generic plans and "initial" pruning

2022-10-17 Thread Amit Langote
On Wed, Oct 12, 2022 at 4:36 PM Amit Langote wrote: > On Fri, Jul 29, 2022 at 1:20 PM Amit Langote wrote: > > On Thu, Jul 28, 2022 at 1:27 AM Robert Haas wrote: > > > 0001 adds es_part_prune_result but does not use it, so maybe the > > > introduction of that field sh

Bitmapsets as Nodes

2022-10-17 Thread Amit Langote
-containing-the-Bitmapset. -- Thanks, Amit Langote EDB: http://www.enterprisedb.com [1] https://commitfest.postgresql.org/40/3478/ [2] https://commitfest.postgresql.org/40/3224/ [3] https://www.postgresql.org/message-id/94353655-c177-1f55-7afb-b2090de33341%40enterprisedb.com [4] https

Re: generic plans and "initial" pruning

2022-10-26 Thread Amit Langote
On Mon, Oct 17, 2022 at 6:29 PM Amit Langote wrote: > On Wed, Oct 12, 2022 at 4:36 PM Amit Langote wrote: > > On Fri, Jul 29, 2022 at 1:20 PM Amit Langote > > wrote: > > > On Thu, Jul 28, 2022 at 1:27 AM Robert Haas wrote: > > > > 0001 adds es_part_prune_

parent foreign tables and row marks

2021-06-01 Thread Amit Langote
) to add a TID row marking junk column if needed. Attached a patch for that, which also adds the test cases. Actually, I had to make a separate version of the patch to apply to the v12 branch, because EXPLAIN outputs relation aliases a bit differently starting in v13, which is attached too. -- Amit Langot

Re: Forget close an open relation in ReorderBufferProcessTXN()

2021-06-01 Thread Amit Langote
On Tue, Jun 1, 2021 at 6:56 PM Amit Kapila wrote: > On Mon, May 31, 2021 at 8:51 AM Amit Langote wrote: > > On Thu, May 27, 2021 at 3:36 PM Amit Kapila wrote: > > > Why do we need to move send_relation_and_attrs() call? I think it > > > doesn't matter much eith

Re: join pushdown and issue with foreign update

2021-06-01 Thread Amit Langote
tables, as we add "wholerow" with type of one child relation > and then > try to use it with another child (of different table type). Perhaps, we can get away with adding the wholerow Var with the target relation's reltype when the target foreign table is not a "child" relation, but the root target relation itself. Maybe like the attached? -- Amit Langote EDB: http://www.enterprisedb.com wholerow-rowid-var-vartype-fix.patch Description: Binary data

Re: join pushdown and issue with foreign update

2021-06-02 Thread Amit Langote
relations, I don't think we have other cases that are affected at this point. I have a feeling that your patch will have fixed things enough that the same problem will not occur when we have join pushdown under UPDATE occurring in more cases. -- Amit Langote EDB: http://www.enterprisedb.com

Re: join pushdown and issue with foreign update

2021-06-02 Thread Amit Langote
ltype = get_rel_type_id(rte->relid); + if (!OidIsValid(reltype)) + continue; + att->atttypid = reltype; That may be a valid concern. I wonder if it would make sense to also check varattno == 0 here somewhere for good measure. -- Amit Langote EDB: http://www.enterprisedb.com

Re: parent foreign tables and row marks

2021-06-02 Thread Amit Langote
On Thu, Jun 3, 2021 at 3:39 AM Tom Lane wrote: > > Amit Langote writes: > > I noticed that 428b260f87e8 (v12) broke the cases where a parent > > foreign table has row marks assigned. > > Indeed :-(. Fix pushed. I tweaked the comments and test case slightly. Thank yo

Re: Skip partition tuple routing with constant partition key

2021-06-03 Thread Amit Langote
Hou-san, On Tue, Jun 1, 2021 at 5:43 PM houzj.f...@fujitsu.com wrote: > From: Amit Langote > > > > Where are you thinking to cache the partidx list? Inside > > > > PartitionDesc or some executor struct? > > > > > > I was thinking cache the

Re: parent foreign tables and row marks

2021-06-03 Thread Amit Langote
On Thu, Jun 3, 2021 at 10:07 AM Amit Langote wrote: > On Thu, Jun 3, 2021 at 3:39 AM Tom Lane wrote: > > > > Amit Langote writes: > > > I noticed that 428b260f87e8 (v12) broke the cases where a parent > > > foreign table has row marks assigned. > > >

Re: Skip partition tuple routing with constant partition key

2021-06-04 Thread Amit Langote
On Thu, Jun 3, 2021 at 8:48 PM Amit Langote wrote: > On Tue, Jun 1, 2021 at 5:43 PM houzj.f...@fujitsu.com > wrote: > > So, If we want to share the cached partition between statements, we seems > > cannot > > use ExecPartitionCheck. Instead, I tried directly invoke th

Re: Skip partition tuple routing with constant partition key

2021-06-04 Thread Amit Langote
On Fri, Jun 4, 2021 at 4:38 PM Amit Langote wrote: > On Thu, Jun 3, 2021 at 8:48 PM Amit Langote wrote: > > On Tue, Jun 1, 2021 at 5:43 PM houzj.f...@fujitsu.com > > wrote: > > > So, If we want to share the cached partition between statements, we seems > > > ca

Re: Skip partition tuple routing with constant partition key

2021-06-04 Thread Amit Langote
On Fri, Jun 4, 2021 at 6:05 PM Amit Langote wrote: > On Fri, Jun 4, 2021 at 4:38 PM Amit Langote wrote: > > On Thu, Jun 3, 2021 at 8:48 PM Amit Langote wrote: > > > On Tue, Jun 1, 2021 at 5:43 PM houzj.f...@fujitsu.com > > > wrote: > > > > So, If we wan

Re: Multi-Column List Partitioning

2021-06-10 Thread Amit Langote
for a and b. I will look at other parts of the patch next week hopefully. For now, attached is a delta patch that applies on top of your v1, which does: * Simplify partition_list_bsearch() and partition_lbound_datum_cmp() * Make qsort_partition_list_value_cmp simply call partition_lbound_datum_cmp() instead of having its own logic to compare input bounds * Move partition_lbound_datum_cmp() into partbounds.c as a static function (export seems unnecessary) * Add a comment for PartitionBoundInfo.isnulls and remove that for null_index -- Amit Langote EDB: http://www.enterprisedb.com v1_delta_amit.patch Description: Binary data

Re: Multi-Column List Partitioning

2021-06-10 Thread Amit Langote
On Fri, Jun 11, 2021 at 12:37 PM Amit Langote wrote: > I will look at other parts of the patch next week hopefully. For > now, attached is a delta patch that applies on top of your v1, which > does: > > * Simplify partition_list_bsearch() and partition_lbound_datum

Re: Skip partition tuple routing with constant partition key

2021-06-16 Thread Amit Langote
serted may be more adaptive. Please find attached a revised version of your patch, where I tried to make it a bit easier to follow, hopefully. While doing so, I realized that caching the bound offset across queries makes little sense now, so I decided to keep the changes confined to execPartitio

Re: Skip partition tuple routing with constant partition key

2021-06-16 Thread Amit Langote
On Wed, Jun 16, 2021 at 4:27 PM Amit Langote wrote: > On Mon, Jun 7, 2021 at 8:38 PM houzj.f...@fujitsu.com > wrote: > > The rough idea is to check the average batch number every 1000 rows. > > If the average batch num is greater than 1, then we enable the cache check, > &g

Re: Decoding speculative insert with toast leaks memory

2021-06-16 Thread Amit Langote
t;pubactions.pubtruncate = false; entry->publish_as_relid = InvalidOid; entry->map = NULL; /* will be set by maybe_send_schema() if needed */ } Do we need the same statement at the end of the following block? /* Validate the entry */ if (!entry->replicate_valid) { -- Amit Langote EDB: http://www.enterprisedb.com

Re: Skip partition tuple routing with constant partition key

2021-06-16 Thread Amit Langote
Hi, Thanks for reading the patch. On Thu, Jun 17, 2021 at 1:46 PM Zhihong Yu wrote: > On Wed, Jun 16, 2021 at 9:29 PM Amit Langote wrote: >> Attached a slightly revised version of that patch, with a commit >> message this time. > > + int n_tup

Re: Decoding speculative insert with toast leaks memory

2021-06-17 Thread Amit Langote
On Thu, Jun 17, 2021 at 3:42 PM Amit Kapila wrote: > On Thu, Jun 17, 2021 at 10:39 AM Amit Langote wrote: > > > > On Thu, Jun 17, 2021 at 12:56 PM Amit Kapila > > wrote: > > > On Wed, Jun 16, 2021 at 8:18 PM Tom Lane wrote: > > > > >

Re: Skip partition tuple routing with constant partition key

2021-06-17 Thread Amit Langote
On Thu, Jun 17, 2021 at 4:18 PM Zhihong Yu wrote: > On Wed, Jun 16, 2021 at 10:37 PM Amit Langote wrote: >> > + if (part_index < 0) >> > + { >> > + bound_offset = >> > partition_range_datum_bsea

Re: Decoding speculative insert with toast leaks memory

2021-06-17 Thread Amit Langote
Hi Dilip, On Thu, Jun 17, 2021 at 4:45 PM Dilip Kumar wrote: > On Thu, Jun 17, 2021 at 12:52 PM Amit Langote wrote: > > > Oh I missed that the problem report is for the PG13 branch. > > > > How about the attached patch then? > > > Looks good, Thanks for ch

Re: Deadlock risk while inserting directly into partition?

2021-06-27 Thread Amit Langote
ich we'd have to do anyway, because perhaps the executor proper (mainly InitPlan) should also see the shrunken version of the range table. Not to mention the complexity of getting the "init" pruning itself to run outside a full-blown executor context. Anyway, do you agre

Re: Deadlock risk while inserting directly into partition?

2021-06-27 Thread Amit Langote
/message-id/16db1458-67cf-4add-736e-31b053115e8e%40lab.ntt.co.jp Maybe a good idea to add a line or 2 in 5.11. Table Partitioning? -- Amit Langote EDB: http://www.enterprisedb.com

Re: Deadlock risk while inserting directly into partition?

2021-06-27 Thread Amit Langote
On Mon, Jun 28, 2021 at 12:58 PM Amit Langote wrote: > On Fri, Jun 25, 2021 at 10:26 AM David Rowley wrote: > > On Thu, 24 Jun 2021 at 12:32, David Rowley wrote: > > > The overhead of taking these locks is pretty significant for > > > partitioned tables with lots of

ExecRTCheckPerms() and many prunable partitions

2021-06-30 Thread Amit Langote
ueries. So while still kind of PoC, will add this to July CF for keeping track. -- Amit Langote EDB: http://www.enterprisedb.com [1] https://www.postgresql.org/message-id/ca+hiwqg7zrubmmih3wpsbz4s0h2ehywrnxeducky5hr3fwz...@mail.gmail.com [2] https://w

Re: ExecRTCheckPerms() and many prunable partitions

2021-06-30 Thread Amit Langote
On Wed, Jun 30, 2021 at 23:34 David Rowley wrote: > On Thu, 1 Jul 2021 at 01:34, Amit Langote wrote: > > For now, I have implemented the idea 2 as the attached patch. > > I only just had a fleeting glance at the patch. Aren't you > accidentally missing the 0th RTE

Re: Record a Bitmapset of non-pruned partitions

2021-06-30 Thread Amit Langote
worthwhile if only for that purpose. He'd suggested that we fix things elsewhere such that that function is not needed in the first place [2], something I keep thinking about in between doing other things, but never sit down to actually write a patch. Given that you're proposing more uses for live_parts, maybe he'd be open to the idea. -- Amit Langote EDB: http://www.enterprisedb.com [1] https://www.postgresql.org/message-id/3f280722-46f2-c2a4-4c19-2cfa28c6c1cd%40lab.ntt.co.jp [2] https://www.postgresql.org/message-id/3529.1554051867%40sss.pgh.pa.us

Re: ExecRTCheckPerms() and many prunable partitions

2021-07-01 Thread Amit Langote
On Fri, Jul 2, 2021 at 12:45 AM Tom Lane wrote: > Amit Langote writes: > > The problem is that it loops over the entire range table even though > > only one or handful of those entries actually need their permissions > > checked. Most entries, especially those of partition

Re: New committers: Daniel Gustafsson and John Naylor

2021-07-01 Thread Amit Langote
> > > Please join me in wishing them much success and few bugs. > > > > regards, tom lane > > Congrats to you both ! +1, congrats Daniel & John! -- Amit Langote EDB: http://www.enterprisedb.com

Re: Allow batched insert during cross-partition updates

2021-07-01 Thread Amit Langote
On Fri, Jul 2, 2021 at 1:39 AM Tom Lane wrote: > > Amit Langote writes: > > [ v6-0001-Allow-batching-of-inserts-during-cross-partition-.patch ] > > Per the cfbot, this isn't applying anymore, so I'm setting it back > to Waiting on Author. Rebased patch att

Re: simplifying foreign key/RI checks

2021-07-05 Thread Amit Langote
d patches attached. -- Amit Langote EDB: http://www.enterprisedb.com v9-0001-Export-get_partition_for_tuple.patch Description: Binary data v9-0002-Avoid-using-SPI-for-some-RI-checks.patch Description: Binary data

Re: ExecRTCheckPerms() and many prunable partitions

2021-07-07 Thread Amit Langote
On Wed, Jul 7, 2021 at 1:41 PM David Rowley wrote: > On Fri, 2 Jul 2021 at 12:41, Amit Langote wrote: > > I'll mark the CF entry as WoA, unless you'd rather I just mark it RwF. > > I've set it to waiting on author. It was still set to needs review. Sorry it slipped

Re: simplifying foreign key/RI checks

2022-05-02 Thread Amit Langote
On Mon, Apr 11, 2022 at 4:47 PM Amit Langote wrote: > This one has been marked Returned with Feedback in the CF app, which > makes sense given the discussion on -committers [1]. > > Agree with the feedback given that it would be better to address *all* > RI trigger check/action f

Re: First draft of the PG 15 release notes

2022-05-11 Thread Amit Langote
On Wed, May 11, 2022 at 12:44 AM Bruce Momjian wrote: > I have completed the first draft of the PG 15 release notes Thanks. Regarding: Improve the trigger behavior of updates on partitioned tables that move rows between partitions (Amit Langote) Previously, such updates fired del

Re: First draft of the PG 15 release notes

2022-05-11 Thread Amit Langote
On Wed, May 11, 2022 at 11:41 PM Bruce Momjian wrote: > On Wed, May 11, 2022 at 04:02:31PM +0900, Amit Langote wrote: > > On Wed, May 11, 2022 at 12:44 AM Bruce Momjian wrote: > > > I have completed the first draft of the PG 15 release notes > > The commit is intended to

Re: First draft of the PG 15 release notes

2022-05-12 Thread Amit Langote
tion root. WFM, thanks. Btw, perhaps the following should be listed under E.1.3.2.1. Logical Replication, not E.1.3.1.1. Partitioning? Remove incorrect duplicate partitions in system view pg_publication_tables (Hou Zhijie) Attached a patch to do so. -- Thanks, Amit La

Re: First draft of the PG 15 release notes

2022-05-12 Thread Amit Langote
On Fri, May 13, 2022 at 11:44 AM Amit Kapila wrote: > On Fri, May 13, 2022 at 7:19 AM Amit Langote wrote: > > > > On Thu, May 12, 2022 at 10:52 PM Bruce Momjian wrote: > > > Okay, I went with: > > > > > > Previously, such updates ran delete act

pgbench --partitions=0

2022-05-15 Thread Amit Langote
ed. cc'ing Michael who authored that commit. -- Thanks, Amit Langote EDB: http://www.enterprisedb.com pgbench-accept-0-partitions.patch Description: Binary data

Re: pgbench --partitions=0

2022-05-15 Thread Amit Langote
On Mon, May 16, 2022 at 2:41 PM Michael Paquier wrote: > On Mon, May 16, 2022 at 11:34:41AM +0900, Amit Langote wrote: > > Attached a patch to fix with a test added. cc'ing Michael who > > authored that commit. > > Indeed, 6f164e6d got that incorrectly. I don't

Re: pgbench --partitions=0

2022-05-17 Thread Amit Langote
On Wed, May 18, 2022 at 9:50 Michael Paquier wrote: > On Mon, May 16, 2022 at 03:00:51PM +0900, Michael Paquier wrote: > > (I have added an open item, just in case.) > > And fixed as of 27f1366 Thank you. -- Thanks, Amit Langote EDB: http://www.enterprisedb.com

Re: First draft of the PG 15 release notes

2022-05-18 Thread Amit Langote
On Sat, May 14, 2022 at 12:42 AM Bruce Momjian wrote: > On Fri, May 13, 2022 at 10:48:41AM +0900, Amit Langote wrote: > > Btw, perhaps the following should be listed under E.1.3.2.1. Logical > > Replication, not E.1.3.1.1. Partitioning? > > > > > > > &g

Re: First draft of the PG 15 release notes

2022-05-19 Thread Amit Langote
On Thu, May 19, 2022 at 2:56 PM David Rowley wrote: > On Thu, 19 May 2022 at 14:41, Amit Langote wrote: > > Though a bit late given beta is now wrapped, I have another partition > > item wording improvement suggestion: > > > > -Previously, a partitioned table with an

enable/disable broken for statement triggers on partitioned tables

2022-05-23 Thread Amit Langote
should do something like the attached. A lot of boilerplate is needed given that the various enable/disable trigger variants are represented as separate sub-commands (AlterTableCmd subtypes), which can perhaps be avoided by inventing a EnableDisableTrigStmt sub-command node that stores (only?) t

Re: First draft of the PG 15 release notes

2022-05-24 Thread Amit Langote
On Wed, May 25, 2022 at 8:36 AM Bruce Momjian wrote: > On Thu, May 19, 2022 at 06:13:28PM +0900, Amit Langote wrote: > > Or maybe we could mention that but use a wording that doesn't make it > > sound like an implementation detail, like: > > > > +Previously, an ord

Re: First draft of the PG 15 release notes

2022-05-24 Thread Amit Langote
On Wed, May 25, 2022 at 12:44 PM David Rowley wrote: > On Wed, 25 May 2022 at 15:01, Amit Langote wrote: > > +Previously, a partitioned table with DEFAULT partition or a LIST > > partition containing multiple values could not be used for ordered > > partition scans. Now it

Re: First draft of the PG 15 release notes

2022-05-25 Thread Amit Langote
On Wed, May 25, 2022 at 1:04 PM Amit Langote wrote: > On Wed, May 25, 2022 at 12:44 PM David Rowley wrote: > > On Wed, 25 May 2022 at 15:01, Amit Langote wrote: > > > +Previously, a partitioned table with DEFAULT partition or a LIST > > > partition containing multip

Re: First draft of the PG 15 release notes

2022-05-25 Thread Amit Langote
On Thu, May 26, 2022 at 11:17 AM Bruce Momjian wrote: > On Thu, May 26, 2022 at 10:31:14AM +0900, Amit Langote wrote: > > * I think it's better to s/...or a LIST partition/...or with a LIST > > partition > > > > * The capitalization of DEFAULT and LIST seems

Re: doc: CREATE FOREIGN TABLE .. PARTITION OF .. DEFAULT

2022-05-25 Thread Amit Langote
ate_table.sgml here as well. Yes. a2a2205761 did that for alter_table.sgml and we evidently missed including create_foreign_table.sgml in that discussion. Attached 2 patches -- one for PG 11 onwards and another for PG 10. -- Thanks, Amit Langote EDB: http://www.enterprisedb.com PG10-missing-partition_bound_spec.patch Description: Binary data missing-partition_bound_spec.patch Description: Binary data

Re: doc: CREATE FOREIGN TABLE .. PARTITION OF .. DEFAULT

2022-05-26 Thread Amit Langote
On Fri, May 27, 2022 at 1:58 AM Robert Haas wrote: > On Thu, May 26, 2022 at 1:50 AM Amit Langote wrote: > > Attached 2 patches -- one for PG 11 onwards and another for PG 10. > > Committed, except I adjusted the v11 version so that the CREATE > FOREIGN TABLE documentation woul

Re: doc phrase: "inheritance child"

2022-05-26 Thread Amit Langote
starelid | stainherit --+ foo | t foo1 | f (2 rows) Maybe you're thinking of RangeTblEntry that the planner makes 2 copies for inheritance parents, but only 1 for partition parents as of e8d5dd6be79. -- Thanks, Amit Langote EDB: http://www.enterprisedb.com

Re: doc phrase: "inheritance child"

2022-05-26 Thread Amit Langote
ollowing be a good rewrite: If true, the stats cover the contents not only of the specified table, but also of its child tables or partitions. (If the table is partitioned, which contains no data by itself, the stats only cover the contents of partitions). Although, maybe the parenthetical is unnecessary. -- Thanks, Amit Langote EDB: http://www.enterprisedb.com

Re: doc: CREATE FOREIGN TABLE .. PARTITION OF .. DEFAULT

2022-05-27 Thread Amit Langote
> I think we should fix the syntax synopsis in the Parameters section > of the CREATE FOREIGN TABLE reference page as well. Oops, good catch. > Attached is a patch for that. Thank you. I think we should also rewrite the description to match the CREATE TABLE's text, as in the att

Re: enable/disable broken for statement triggers on partitioned tables

2022-05-27 Thread Amit Langote
7;t change. > > That's a concern if backpatching. Otherwise, it's better to put them > like shown in the patch. Agreed. -- Thanks, Amit Langote EDB: http://www.enterprisedb.com

Re: adding status for COPY progress report

2022-05-31 Thread Amit Langote
ut that in the shared memory, or at least not with one-off adjustments of the shared progress reporting state like in the proposed patch. -- Thanks, Amit Langote EDB: http://www.enterprisedb.com

Re: doc: CREATE FOREIGN TABLE .. PARTITION OF .. DEFAULT

2022-06-01 Thread Amit Langote
e can live > without it, so I changed my mind; I'll go with my version. I think we > could revisit this later. I guess I'm fine with leaving the text as-is, though slightly bothered by leaving the phrase "partition of the given parent table with specified partition bound va

Re: doc: CREATE FOREIGN TABLE .. PARTITION OF .. DEFAULT

2022-06-02 Thread Amit Langote
On Thu, Jun 2, 2022 at 6:14 PM Etsuro Fujita wrote: > On Thu, Jun 2, 2022 at 10:23 AM Amit Langote wrote: > > On Wed, Jun 1, 2022 at 6:15 PM Etsuro Fujita > > wrote: > > > On Tue, May 31, 2022 at 9:35 PM Robert Haas wrote: > > > > I would probably just upd

Re: Replica Identity check of partition table on subscriber

2022-06-09 Thread Amit Langote
pport to replicate into > partitioned tables), so adding Amit L. and Peter E. Thanks, I can see the problem. I have looked at other mentioned problems with the code too and agree they look like bugs. Both patches look to be on the right track to fix the issues, but will look more closely to see if I've anything to add. -- Thanks, Amit Langote EDB: http://www.enterprisedb.com

Re: Replica Identity check of partition table on subscriber

2022-06-10 Thread Amit Langote
. @@ -584,7 +594,6 @@ logicalrep_partition_open(LogicalRepRelMapEntry *root, Oid partOid = RelationGetRelid(partrel); AttrMap *attrmap = root->attrmap; boolfound; - int i; MemoryContext oldctx; if (LogicalRepPartMap == NULL) > Thanks to Hou Zhijie for helping me in the first patch. Thank you both for the fixes. > I will add a test for it later That would be very welcome. -- Thanks, Amit Langote EDB: http://www.enterprisedb.com [1] https://www.postgresql.org/message-id/flat/201902041630.gpadougzab7v%40alvherre.pgsql

Re: Replica Identity check of partition table on subscriber

2022-06-13 Thread Amit Langote
On Sat, Jun 11, 2022 at 10:36 AM Amit Kapila wrote: > On Fri, Jun 10, 2022 at 2:26 PM Amit Langote wrote: > > > > +logicalrep_partmap_invalidate > > > > I wonder why not call this logicalrep_partmap_update() to go with > > logicalrep_relmap_upda

Re: Replica Identity check of partition table on subscriber

2022-06-13 Thread Amit Langote
t part. Also how about being more specific about the test intent, say: Test that replication continues to work correctly after altering the partition of a partitioned target table. -- Thanks, Amit Langote EDB: http://www.enterprisedb.com

Re: Replica Identity check of partition table on subscriber

2022-06-13 Thread Amit Langote
On Mon, Jun 13, 2022 at 6:14 PM Amit Kapila wrote: > On Mon, Jun 13, 2022 at 2:20 PM Amit Langote wrote: > > On Sat, Jun 11, 2022 at 10:36 AM Amit Kapila > > wrote: > > > On Fri, Jun 10, 2022 at 2:26 PM Amit Langote > > > wrote: > > >

Re: Replica Identity check of partition table on subscriber

2022-06-14 Thread Amit Langote
On Tue, Jun 14, 2022 at 3:31 PM Amit Langote wrote: > On Mon, Jun 13, 2022 at 6:14 PM Amit Kapila wrote: > > I think we can do that way as well but do you see any benefit in it? > > The way I am suggesting will avoid the effort of updating the remote > > rel copy till

Re: Replica Identity check of partition table on subscriber

2022-06-14 Thread Amit Langote
On Tue, Jun 14, 2022 at 9:57 PM Amit Kapila wrote: > On Tue, Jun 14, 2022 at 1:02 PM Amit Langote wrote: > > > +# Change the column order of table on publisher > > I think it might be better to say something specific to describe the > > test intent, like: > >

Re: Replica Identity check of partition table on subscriber

2022-06-15 Thread Amit Langote
ot; here really means no-longer-useful, so we should use that phrase as a nearby comment does: Release the no-longer-useful attrmap, if any. -- Thanks, Amit Langote EDB: http://www.enterprisedb.com

Re: Replica Identity check of partition table on subscriber

2022-06-16 Thread Amit Langote
On Thu, Jun 16, 2022 at 3:45 PM Amit Kapila wrote: > On Thu, Jun 16, 2022 at 11:43 AM Amit Langote wrote: > > + * Don't throw any error here just mark the relation entry as not > > updatable, > > + * as replica identity is only for updates and deletes but inserts can

Re: Replica Identity check of partition table on subscriber

2022-06-16 Thread Amit Langote
On Thu, Jun 16, 2022 at 6:42 PM Amit Kapila wrote: > On Fri, Jun 10, 2022 at 2:26 PM Amit Langote wrote: > > @@ -1735,6 +1735,13 @@ apply_handle_insert_internal(ApplyExecutionData > > *edata, > > static void > > check_relation_updatable

Re: Replica Identity check of partition table on subscriber

2022-06-16 Thread Amit Langote
On Thu, Jun 16, 2022 at 9:28 PM Amit Kapila wrote: > On Thu, Jun 16, 2022 at 5:24 PM Amit Langote wrote: > > On Thu, Jun 16, 2022 at 6:42 PM Amit Kapila wrote: > > > On Fri, Jun 10, 2022 at 2:26 PM Amit Langote > > > wrote: > > > > @@ -1735,6 +

Re: Replica Identity check of partition table on subscriber

2022-06-20 Thread Amit Langote
t;leaf" partition is updatable Regarding the commit message's top line, which is this: Fix partition table's RI checking on the subscriber. I think it should spell out REPLICA IDENTITY explicitly to avoid the commit being confused to have to do with "Referential Integrity checking". -- Thanks, Amit Langote EDB: http://www.enterprisedb.com

<    10   11   12   13   14   15   16   17   18   19   >