Re: List of Bitmapset (was Re: ExecRTCheckPerms() and many prunable partitions)

2022-11-14 Thread Amit Langote
On Mon, Nov 14, 2022 at 11:57 PM Tom Lane wrote: > Amit Langote writes: > > On Sat, Nov 12, 2022 at 1:46 AM Tom Lane wrote: > >> The main thing I was wondering about in connection with that > >> was whether to assume that there could be other future applications &

Re: ExecRTCheckPerms() and many prunable partitions

2022-11-13 Thread Amit Langote
On Sat, Nov 12, 2022 at 1:46 AM Tom Lane wrote: > Alvaro Herrera writes: > > On 2022-Oct-06, Amit Langote wrote: > >> Actually, List of Bitmapsets turned out to be something that doesn't > >> just-work with our Node infrastructure, which I found out thanks to > &g

Re: Making Bitmapsets be valid Nodes

2022-11-13 Thread Amit Langote
an extra function call by changing COPY_BITMAPSET_FIELD, etc. that is currently emitted by gen_node_support.pl for any Bitmapset * / Relid struct members to COPY_NODE_FIELD, etc. -- Thanks, Amit Langote EDB: http://www.enterprisedb.com

Re: Bitmapsets as Nodes

2022-11-13 Thread Amit Langote
On Mon, Oct 17, 2022 at 6:30 PM Amit Langote wrote: > For a couple of patches that I am working on ([1], [2]), I have needed > to put Bitmapsets into a List that is in turn part of a Plan tree or a > Node tree that may be written (using outNode) and read (using > nodeRead). Bitmapse

Re: generic plans and "initial" pruning

2022-11-07 Thread Amit Langote
On Thu, Oct 27, 2022 at 11:41 AM Amit Langote wrote: > 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: > > > >

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_

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-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

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: 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

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: 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

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

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 revision f

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 32b

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 > >> actu

Re: ExecRTCheckPerms() and many prunable partitions

2022-10-03 Thread Amit Langote
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: 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: 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 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 Parti

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: missing indexes in indexlist with partitioned tables

2022-09-20 Thread Amit Langote
On Tue, Sep 20, 2022 at 4:53 PM David Rowley wrote: > Thank you for having a look at the patch. > > On Tue, 20 Sept 2022 at 18:41, Amit Langote wrote: > > Agreed, though the patch's changes to tests does not seem to have to > > do with join removal? I don't really und

Re: missing indexes in indexlist with partitioned tables

2022-09-20 Thread Amit Langote
perhaps needs an update. * If inhparent is true, all we need to do is set up the attr arrays: * the RelOptInfo actually represents the appendrel formed by an inheritance * tree, and so the parent rel's physical size and index information isn't * important for it. */ -- Thanks, Am

Re: cataloguing NOT NULL constraints

2022-09-12 Thread Amit Langote
d NOT NULL constraint Maybe you did and thought that it's OK for it to spell out the internally generated constraint name, because we already require users to know that they exist, say to drop it using DROP CONSTRAINT. -- Thanks, Amit Langote EDB: http://www.enterprisedb.com [1] https://www.postgresql.org/message-id/CA%2BHiwqFggpjAvsVqNV06HUF6CUrU0Vo3pLgGWCViGbPkzTiofg%40mail.gmail.com

Re: [BUG] wrong FK constraint name when colliding name on ATTACH

2022-09-09 Thread Amit Langote
d counsel dropping the early-exit optimization; it doesn't > save much I expect, and it evidently hides bugs. Or maybe > make it conditional on !USE_ASSERT_CHECKING. While neither of these functions are called in hot paths, I am inclined to keep the early-exit bit in non-assert builds. Attached a patch. -- Thanks, Amit Langote EDB: http://www.enterprisedb.com action-check-trigger-filter.patch Description: Binary data

Re: ATExecAddColumn() doesn't merge inherited properties

2022-09-08 Thread Amit Langote
On Thu, Sep 8, 2022 at 9:03 PM Amit Langote wrote: > While testing Alvaro's "cataloguing NOT NULL constraints" patch [1], I > noticed a behavior of inherited column merging during ALTER TABLE that > I thought might be a bug (though see at the bottom). > > I feel l

ATExecAddColumn() doesn't merge inherited properties

2022-09-08 Thread Amit Langote
lumn to the parent after-the-fact will allow its generated definition to differ from that of the child's existing column, which is not allowed when creating the child table with its own different generated definition for its column. I feel like we may have discussed this before and decided that the

Re: SQL/JSON features for v15

2022-09-05 Thread Amit Langote
On Fri, Sep 2, 2022 at 8:56 PM Justin Pryzby wrote: > On Wed, Aug 31, 2022 at 03:51:18PM +0900, Amit Langote wrote: > > Finally, I get this warning: > > > > execExprInterp.c: In function ‘ExecJsonCoerceCStringToText’: > > execExprInterp.c:4765:3: warning: missin

Re: SQL/JSON features for v15

2022-08-31 Thread Amit Langote
On Wed, Aug 31, 2022 at 3:51 PM Amit Langote wrote: > SELECT JSON_VALUE(jsonb '"aaa"', '$' RETURNING int DEFAULT 111 ON ERROR); > - json_value > - > -111 > -(1 row) > - > +ERROR: syntax error at or near "DEFAULT" > +LINE 1: ...E

Re: SQL/JSON features for v15

2022-08-31 Thread Amit Langote
On Wed, Aug 31, 2022 at 3:51 PM Amit Langote wrote: > On Wed, Aug 31, 2022 at 6:25 AM Nikita Glukhov > wrote: > > v10 patches > > Finally, I get this warning: > > execExprInterp.c: In function ‘ExecJsonCoerceCStringToText’: > execExprInterp.c:4765:3: warning: missin

Re: SQL/JSON features for v15

2022-08-31 Thread Amit Langote
On Wed, Aug 31, 2022 at 6:25 AM Nikita Glukhov wrote: > On 30.08.2022 11:09, Amit Langote wrote: > First of all, regarding 0009, my understanding was that we should > disallow DEFAULT expression ON ERROR too for now, so something like > the following does not occur: > > SELEC

Re: SQL/JSON features for v15

2022-08-30 Thread Amit Langote
On Tue, Aug 30, 2022 at 6:19 PM Alvaro Herrera wrote: > On 2022-Aug-30, Amit Langote wrote: > > > Patches 0001-0006: > > > > Yeah, these add the overhead of an extra function call (typin() -> > > typin_opt_error()) in possibly very common paths. Other than >

Re: SQL/JSON features for v15

2022-08-30 Thread Amit Langote
On Tue, Aug 30, 2022 at 6:49 AM Nikita Glukhov wrote: > On 29.08.2022 15:56, Amit Langote wrote: > On Sat, Aug 27, 2022 at 5:11 AM Nikita Glukhov > wrote: > I have completed in v9 all the things I previously planned: > > BTW, maybe the following hunk in boolin_opt_erro

Re: SQL/JSON features for v15

2022-08-29 Thread Amit Langote
would be nice indeed. I'm wondering if you're going to change the PASSING values initialization to add the steps into the parent JsonExpr's ExprState, like the previous patch was doing? -- Thanks, Amit Langote EDB: http://www.enterprisedb.com

Re: SQL/JSON features for v15

2022-08-23 Thread Amit Langote
On Wed, Aug 24, 2022 at 11:55 AM Amit Langote wrote: > On Wed, Aug 24, 2022 at 6:29 AM Nikita Glukhov > wrote: > > Here is my plan: > > > > 0. Take my last v7-0001 patch as a base. It already contains refactoring > > of JsonCoercion code. (Fix 0002

Re: SQL/JSON features for v15

2022-08-23 Thread Amit Langote
avior - * representation of JSON ON ... BEHAVIOR clause */ typedef struct JsonBehavior { NodeTag type; JsonBehaviorType btype; /* behavior type */ Node *default_expr; /* default expression, if any */ } JsonBehavior; And if so, no expression left to check the Const-ness of? -- Thanks, Amit Langote EDB: http://www.enterprisedb.com

Re: SQL/JSON features for v15

2022-08-23 Thread Amit Langote
On Tue, Aug 23, 2022 at 4:48 PM Amit Langote wrote: > On Thu, Aug 18, 2022 at 12:46 PM Nikita Glukhov > wrote: > > The desciprion of the v7 patches: > > > > 0003 Add EEOP_SUBTRANS executor step > > v6 + new recursive JIT > > > > 0004 Split JsonExp

Re: SQL/JSON features for v15

2022-08-23 Thread Amit Langote
4 Split JsonExpr execution into steps > simply rebase of v6 + used LLMBuildSwitch() in EEOP_JSONEXPR Will need to spend more time looking at these. -- Thanks, Amit Langote EDB: http://www.enterprisedb.com

Re: SQL/JSON features for v15

2022-08-22 Thread Amit Langote
On Tue, Aug 23, 2022 at 10:52 AM Jonathan S. Katz wrote: > Andres, Andrew, Amit, Robert -- as you have either worked on this or > expressed opinions -- any thoughts on this current patch set? FWIW, I've started looking at these patches. -- Thanks, Amit Langote EDB: http://www.enterprisedb.com

Re: cataloguing NOT NULL constraints

2022-08-21 Thread Amit Langote
| not null | Partition of: pp DEFAULT alter table cc alter a drop not null ; ERROR: column "a" is marked NOT NULL in parent table IIRC, I had tried to propose implementing the same behavior for legacy inheritance back in the day, but maybe we left it alone for not breaking compatibility. -- Thanks, Amit Langote EDB: http://www.enterprisedb.com

Re: PG 15 (and to a smaller degree 14) regression due to ExprEvalStep size

2022-08-10 Thread Amit Langote
ecInterpExpr() anyway, so maybe you meant the io coercion itself was done using some code outside ExecInterpExpr()? The current JsonExpr code does it by recursively calling ExecInterpExpr() using the nested ExprState expressly for the coercion. -- Thanks, Amit Langote EDB: http://www.enterprisedb.com

Re: PG 15 (and to a smaller degree 14) regression due to ExprEvalStep size

2022-08-08 Thread Amit Langote
Hi Andres, On Sat, Aug 6, 2022 at 5:37 AM Andres Freund wrote: > On 2022-08-04 17:01:48 +0900, Amit Langote wrote: > > On Wed, Aug 3, 2022 at 12:00 AM Andres Freund wrote: > > > Honestly, this code seems like it should just be rewritten from scratch. > > > > Based

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

2022-08-05 Thread Amit Langote
On Fri, Aug 5, 2022 at 6:58 PM Alvaro Herrera wrote: > OK, pushed. This soon caused buildfarm to show a failure due to > underspecified ORDER BY, so I just pushed a fix for that too. Thank you. -- Thanks, Amit Langote EDB: http://www.enterprisedb.com

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

2022-08-04 Thread Amit Langote
EnableDisableTrigger( all args ) > #endif > > and otherwise they're compatible as compiled today. > > Since there are no known users of this interface, it doesn't seem to > warrant any more convenient treatment. Makes sense. -- Thanks, Amit Langote EDB: http://www.enterprisedb.com

Re: PG 15 (and to a smaller degree 14) regression due to ExprEvalStep size

2022-08-04 Thread Amit Langote
Hi, On Wed, Aug 3, 2022 at 12:00 AM Andres Freund wrote: > On 2022-08-02 12:05:55 +0900, Amit Langote wrote: > > On Tue, Aug 2, 2022 at 9:39 AM Andres Freund wrote: > > > On 2022-07-27 17:01:13 +0900, Amit Langote wrote: > > > > Here's an updated version of t

Re: Eliminating SPI from RI triggers - take 2

2022-08-03 Thread Amit Langote
On Wed, Jul 13, 2022 at 8:59 PM Amit Langote wrote: > On Sat, Jul 9, 2022 at 1:15 AM Robert Haas wrote: > Thanks for taking a look at this. I'll try to respond to other points > in a separate email, but I wanted to clarify something about below: > > > I find my eg

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

2022-08-03 Thread Amit Langote
On Thu, Aug 4, 2022 at 3:01 AM Alvaro Herrera wrote: > On 2022-Aug-02, Amit Langote wrote: > > Regarding the patch, I agree that storing the recurse flag rather than > > overwriting subtype might be better. > > > > + boolexecTimeRecursion; /* set by

Re: Skip partition tuple routing with constant partition key

2022-08-02 Thread Amit Langote
On Tue, Aug 2, 2022 at 6:58 AM David Rowley wrote: > On Thu, 28 Jul 2022 at 19:37, Amit Langote wrote: > > > > On Thu, Jul 28, 2022 at 11:59 AM David Rowley wrote: > > > > I'd quite like to push this patch early next week, so if anyone else > > > is

Re: PG 15 (and to a smaller degree 14) regression due to ExprEvalStep size

2022-08-01 Thread Amit Langote
Hi, Thanks for looking into this. On Tue, Aug 2, 2022 at 9:39 AM Andres Freund wrote: > On 2022-07-27 17:01:13 +0900, Amit Langote wrote: > > Here's an updated version of the patch, with mostly cosmetic changes. > > In particular, I added comments describing the new ll

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

2022-08-01 Thread Amit Langote
On Tue, Aug 2, 2022 at 3:58 AM Alvaro Herrera wrote: > On 2022-Aug-01, Amit Langote wrote: > > > On Sat, Jul 30, 2022 at 5:25 AM Tom Lane wrote: > > > > I do not think it's a great idea to have ALTER TABLE scribbling on > > > the source parsetree. > >

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

2022-07-31 Thread Amit Langote
eredTableInfo, instead of AlterTableCmd. AlteredTableInfo has other runtime info about the relation being altered and perhaps it wouldn't be too bad if it also stores the inh/recurse flag. -- Thanks, Amit Langote EDB: http://www.enterprisedb.com

Re: generic plans and "initial" pruning

2022-07-28 Thread Amit Langote
On Thu, Jul 28, 2022 at 1:27 AM Robert Haas wrote: > On Tue, Jul 26, 2022 at 11:01 PM Amit Langote wrote: > > Needed to be rebased again, over 2d04277121f this time. Thanks for looking. > 0001 adds es_part_prune_result but does not use it, so maybe the > introduction of th

Re: Skip partition tuple routing with constant partition key

2022-07-28 Thread Amit Langote
On Thu, Jul 28, 2022 at 11:59 AM David Rowley wrote: > On Thu, 28 Jul 2022 at 00:50, Amit Langote wrote: > > So, in a way the caching scheme works for > > LIST partitioning only if the same value appears consecutively in the > > input set, whereas it does not for *a set

Re: Skip partition tuple routing with constant partition key

2022-07-27 Thread Amit Langote
On Wed, Jul 27, 2022 at 7:28 AM David Rowley wrote: > On Sat, 23 Jul 2022 at 01:23, Amit Langote wrote: > > + /* > > +* The Datum has changed. Zero the number of times > > we've > > +* found last

Re: PG 15 (and to a smaller degree 14) regression due to ExprEvalStep size

2022-07-27 Thread Amit Langote
On Fri, Jul 22, 2022 at 2:49 PM Amit Langote wrote: > On Fri, Jul 22, 2022 at 1:13 PM David Rowley wrote: > > BTW, I was working on code inside llvm_compile_expr() a few days ago > > and I thought I'd gotten the new evaluation steps I was adding correct > > as it worked fin

Re: generic plans and "initial" pruning

2022-07-26 Thread Amit Langote
On Wed, Jul 13, 2022 at 4:03 PM Amit Langote wrote: > On Wed, Jul 13, 2022 at 3:40 PM Amit Langote wrote: > > Rebased over 964d01ae90c. > > Sorry, left some pointless hunks in there while rebasing. Fixed in > the attached. Needed to be rebased again, over 2d04277121f this

Re: Skip partition tuple routing with constant partition key

2022-07-22 Thread Amit Langote
E + * partitioned tables mean that the same partition is likely to be found in mean -> are such that we record the partition index we've found in the + * PartitionDesc we record the partition index we've found *for given values* in the PartitionDesc -- Thanks, Amit Langote EDB: http://www.enterprisedb.com

Re: PG 15 (and to a smaller degree 14) regression due to ExprEvalStep size

2022-07-21 Thread Amit Langote
On Fri, Jul 22, 2022 at 1:13 PM David Rowley wrote: > On Fri, 22 Jul 2022 at 15:22, Amit Langote wrote: > > BTW, the only way I found to *forcefully* exercise llvm_compile_expr() > > is to add `set jit_above_cost to 0` at the top of the test file, or > > are we missing a

Re: PG 15 (and to a smaller degree 14) regression due to ExprEvalStep size

2022-07-21 Thread Amit Langote
On Fri, Jul 22, 2022 at 2:12 AM Alvaro Herrera wrote: > On 2022-Jul-21, Amit Langote wrote: > > > Because I wrote all of it while not really understanding how the LLVM > > constructs like blocks and branches work, the only reason I think > > those llvm_compile_expr()

Re: PG 15 (and to a smaller degree 14) regression due to ExprEvalStep size

2022-07-21 Thread Amit Langote
On Thu, Jul 21, 2022 at 11:55 PM Amit Langote wrote: > On Wed, Jul 20, 2022 at 11:09 PM Amit Langote wrote: > > On Wed, Jul 20, 2022 at 12:37 AM Andres Freund wrote: > > > On 2022-07-19 20:40:11 +0900, Amit Langote wrote: > > > > About that, I was wondering if t

Re: PG 15 (and to a smaller degree 14) regression due to ExprEvalStep size

2022-07-21 Thread Amit Langote
On Wed, Jul 20, 2022 at 11:09 PM Amit Langote wrote: > On Wed, Jul 20, 2022 at 12:37 AM Andres Freund wrote: > > On 2022-07-19 20:40:11 +0900, Amit Langote wrote: > > > About that, I was wondering if the blocks in llvm_compile_expr() need > > > to be hand-

Re: PG 15 (and to a smaller degree 14) regression due to ExprEvalStep size

2022-07-20 Thread Amit Langote
On Wed, Jul 20, 2022 at 12:37 AM Andres Freund wrote: > On 2022-07-19 20:40:11 +0900, Amit Langote wrote: > > About that, I was wondering if the blocks in llvm_compile_expr() need > > to be hand-coded to match what's added in ExecInterpExpr() or if I've > > missed some

Re: PG 15 (and to a smaller degree 14) regression due to ExprEvalStep size

2022-07-19 Thread Amit Langote
er more > intractable than I expected. Almost all the legwork here has been done > by Amit Langote, for which he deserves both my thanks and considerable > credit, but I take responsibility for it. > > I just discovered today that this scheme is failing under > "force_par

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

2022-07-14 Thread Amit Langote
dy for committer. Great, thanks. -- Thanks, Amit Langote EDB: http://www.enterprisedb.com

Re: Eliminating SPI from RI triggers - take 2

2022-07-13 Thread Amit Langote
On Sat, Jul 9, 2022 at 1:15 AM Robert Haas wrote: > On Fri, Jul 1, 2022 at 2:23 AM Amit Langote wrote: > > So, I hacked together a patch (attached 0001) that invents an "RI > > plan" construct (struct RIPlan) to replace the use of an "SPI plan" > > (stru

Re: generic plans and "initial" pruning

2022-07-13 Thread Amit Langote
On Wed, Jul 13, 2022 at 3:40 PM Amit Langote wrote: > Rebased over 964d01ae90c. Sorry, left some pointless hunks in there while rebasing. Fixed in the attached. -- Thanks, Amit Langote EDB: http://www.enterprisedb.com v19-0001-Move-PartitioPruneInfo-out-of-plan-nodes-into-Pl.pa

Re: generic plans and "initial" pruning

2022-07-13 Thread Amit Langote
Rebased over 964d01ae90c. -- Thanks, Amit Langote EDB: http://www.enterprisedb.com v18-0002-Optimize-AcquireExecutorLocks-by-locking-only-un.patch Description: Binary data v18-0001-Move-PartitioPruneInfo-out-of-plan-nodes-into-Pl.patch Description: Binary data

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

2022-07-12 Thread Amit Langote
| tgenabled > -++--- > child1 | tg | A > parent | tg | A > (2 rows) > > DROP TABLE > DROP FUNCTION > > The patch doesn't start recursion in case 'tgenabled' flag of parent > table is not changes. > Probably vanilla

Re: Eliminating SPI from RI triggers - take 2

2022-07-06 Thread Amit Langote
On Wed, Jul 6, 2022 at 11:55 AM Amit Langote wrote: > On Wed, Jul 6, 2022 at 3:24 AM Jacob Champion wrote: > > On Thu, Jun 30, 2022 at 11:23 PM Amit Langote > > wrote: > > > > > > I will continue investigating what to do about points (1) and (2) > > >

Re: Eliminating SPI from RI triggers - take 2

2022-07-05 Thread Amit Langote
On Wed, Jul 6, 2022 at 3:24 AM Jacob Champion wrote: > On Thu, Jun 30, 2022 at 11:23 PM Amit Langote wrote: > > > > I will continue investigating what to do about points (1) and (2) > > mentioned above and see if we can do away with using SQL in the > > remaining cas

Re: doc phrase: "inheritance child"

2022-07-05 Thread Amit Langote
On Thu, Jun 30, 2022 at 6:55 PM Justin Pryzby wrote: > On Fri, May 27, 2022 at 03:22:38PM +0900, Amit Langote wrote: > > On Wed, May 25, 2022 at 1:30 PM Ashutosh Bapat > > wrote: > > > > > > - If true, the stats include inheritance child columns, n

Eliminating SPI from RI triggers - take 2

2022-07-01 Thread Amit Langote
ction is implemented using SQL plan or a hard-code plan, the execution should proceed with the effectively same config/environment. I will continue investigating what to do about points (1) and (2) mentioned above and see if we can do away with using SQL in the remaining cases. -- Thanks, Am

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

2022-06-29 Thread Amit Langote
On Tue, May 24, 2022 at 3:11 PM Amit Langote wrote: > Simon reported $subject off-list. > > For triggers on partitioned tables, various enable/disable trigger > variants recurse to also process partitions' triggers by way of > ATSimpleRecursion() done in the "prep&quo

Re: Replica Identity check of partition table on subscriber

2022-06-22 Thread Amit Langote
On Wed, Jun 22, 2022 at 8:05 PM Amit Kapila wrote: > On Wed, Jun 22, 2022 at 10:09 AM Amit Langote wrote: > > On Wed, Jun 22, 2022 at 12:02 PM houzj.f...@fujitsu.com > > wrote: > > > Since the patch has been committed. Attach the last patch to fix the > > >

Re: Replica Identity check of partition table on subscriber

2022-06-21 Thread Amit Langote
ch is a single array like: > > entry->attrmap = palloc(desc->natts * sizeof(AttrNumber)); LGTM, thank you. -- Thanks, Amit Langote EDB: http://www.enterprisedb.com

Re: Replica Identity check of partition table on subscriber

2022-06-21 Thread Amit Langote
On Tue, Jun 21, 2022 at 5:08 PM houzj.f...@fujitsu.com wrote: > On Tuesday, June 21, 2022 3:21 PM Amit Langote > wrote: > > Thanks for the patch. > > > > I agree it's an old bug. A partition map entry's localrel may point > > to a stale Relation pointer, beca

Re: Replica Identity check of partition table on subscriber

2022-06-21 Thread Amit Langote
Note that localrelvalid is +* only updated by the relcache invalidation callback, so it may still be +* true irrespective of whether the Relation pointed to by localrel has +* been cleared or not. +*/ if (found && entry->localrelvalid) + { + entry->loca

Re: Replica Identity check of partition table on subscriber

2022-06-20 Thread Amit Langote
quot;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

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-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 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 be &g

Re: Replica Identity check of partition table on subscriber

2022-06-16 Thread Amit Langote
s 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-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-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

Re: Replica Identity check of partition table on subscriber

2022-06-14 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
lso 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 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-10 Thread Amit Langote
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-09 Thread Amit Langote
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: 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: doc: CREATE FOREIGN TABLE .. PARTITION OF .. DEFAULT

2022-06-01 Thread Amit Langote
out 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 values" to also cover the D

Re: adding status for COPY progress report

2022-05-31 Thread Amit Langote
t 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: enable/disable broken for statement triggers on partitioned tables

2022-05-27 Thread Amit Langote
. > > 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: 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 attached

Re: doc phrase: "inheritance child"

2022-05-27 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 phrase: "inheritance child"

2022-05-26 Thread Amit Langote
- 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: 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: CREATE FOREIGN TABLE .. PARTITION OF .. DEFAULT

2022-05-25 Thread Amit Langote
ll. 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: 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 u

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

<    1   2   3   4   5   6   7   8   9   10   >