Re: default partition and concurrent attach partition

2020-09-08 Thread Amit Langote
On Wed, Sep 9, 2020 at 7:41 AM Alvaro Herrera wrote: > On 2020-Sep-08, Amit Langote wrote: > > > Yeah, we need to make sure that ExecPartitionCheck gets a slot whose > > TupleDesc matches the partition's. Actually we do have such dedicated > > slots for partitions around (for both sub-partitioned

Re: default partition and concurrent attach partition

2020-09-08 Thread Alvaro Herrera
On 2020-Sep-08, Amit Langote wrote: > Yeah, we need to make sure that ExecPartitionCheck gets a slot whose > TupleDesc matches the partition's. Actually we do have such dedicated > slots for partitions around (for both sub-partitioned and leaf > partitions), so we can simply use them instead of c

Re: default partition and concurrent attach partition

2020-09-08 Thread Alvaro Herrera
On 2020-Sep-08, Alvaro Herrera wrote: > Andres added to CC because of TTS interface: apparently calling > slot_getallattrs() on a virtual slot raises error that "getsomeattrs is > not required to be called on a virtual tuple table slot". I'm thinking > that this exposes implementation details tha

Re: default partition and concurrent attach partition

2020-09-08 Thread Alvaro Herrera
Hi, Andres added to CC because of TTS interface: apparently calling slot_getallattrs() on a virtual slot raises error that "getsomeattrs is not required to be called on a virtual tuple table slot". I'm thinking that this exposes implementation details that should not be necessary for a caller to

Re: default partition and concurrent attach partition

2020-09-08 Thread Alvaro Herrera
Hello Amit, On 2020-Sep-08, Amit Langote wrote: > On Tue, Sep 8, 2020 at 8:44 AM Alvaro Herrera > wrote: > > On 2020-Sep-07, Alvaro Herrera wrote: > > > > > Ah, it looks like we can get away with initializing the RRI to 0, and > > > then explicitly handle that case in ExecPartitionCheckEmitErro

Re: default partition and concurrent attach partition

2020-09-08 Thread Amit Langote
Hi Alvaro, On Tue, Sep 8, 2020 at 8:44 AM Alvaro Herrera wrote: > On 2020-Sep-07, Alvaro Herrera wrote: > > > Ah, it looks like we can get away with initializing the RRI to 0, and > > then explicitly handle that case in ExecPartitionCheckEmitError, as in > > the attached (which means reindenting,

Re: default partition and concurrent attach partition

2020-09-07 Thread Alvaro Herrera
On 2020-Sep-07, Alvaro Herrera wrote: > Ah, it looks like we can get away with initializing the RRI to 0, and > then explicitly handle that case in ExecPartitionCheckEmitError, as in > the attached (which means reindenting, but I left it alone to make it > easy to read). Well, that was silly -- t

Re: default partition and concurrent attach partition

2020-09-07 Thread Alvaro Herrera
Ah, it looks like we can get away with initializing the RRI to 0, and then explicitly handle that case in ExecPartitionCheckEmitError, as in the attached (which means reindenting, but I left it alone to make it easy to read). It kinda sucks because we don't report the tuple that causes the error,

Re: default partition and concurrent attach partition

2020-09-07 Thread Alvaro Herrera
On 2020-Sep-07, Alvaro Herrera wrote: > Well, they are fake in that the ri_RangeTableIndex they carry is bogus, > which means that ExecBuildSlotValueDescription will misbehave if the > partitioned default partition has a different column order than its > parent. That can be evidenced by changing

Re: default partition and concurrent attach partition

2020-09-07 Thread Alvaro Herrera
On 2020-Sep-04, Amit Langote wrote: Hello > FWIW, I still prefer "minimally valid ResultRelInfo" to "fake > ResultRelInfo", because those aren't really fake, are they? They are > as valid as any other ResultRelInfo as far I can see. I said > "minimally valid" because a fully-valid partition Res

Re: default partition and concurrent attach partition

2020-09-03 Thread Amit Langote
Hi Alvaro, On Fri, Sep 4, 2020 at 6:28 AM Alvaro Herrera wrote: > > Also, I should have pointed out that ExecInsert doesn't actually check > the partitin constraint except in very specific cases; what it does is > expect that the partition routing code got it right. So the comment > you're addin

Re: default partition and concurrent attach partition

2020-09-03 Thread Alvaro Herrera
Also, I should have pointed out that ExecInsert doesn't actually check the partitin constraint except in very specific cases; what it does is expect that the partition routing code got it right. So the comment you're adding about that is wrong, and it did misled me into changing your code in a way

Re: default partition and concurrent attach partition

2020-09-03 Thread Alvaro Herrera
On 2020-Sep-03, Alvaro Herrera wrote: > + /* > + * If setting up a PartitionDispatch for a sub-partitioned table, we may > + * also need a fake ResultRelInfo for checking the partition constraint > + * later; set that up now. > + */ > + if (parent_pd) > + { > +

Re: default partition and concurrent attach partition

2020-09-03 Thread Alvaro Herrera
Thanks for this fix! Looking into it now. -- Álvaro Herrerahttps://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services diff --git a/src/backend/executor/execPartition.c b/src/backend/executor/execPartition.c index 4d34734a45..fe42670e0a 100

Re: default partition and concurrent attach partition

2020-09-03 Thread Amit Langote
On Thu, Sep 3, 2020 at 6:50 PM Amit Langote wrote: > > Hi, > > Starting a new thread to discuss a bug related to $subject that Hao Wu > reported on thread titled "ALTER TABLE .. DETACH PARTITION > CONCURRENTLY" [1]. I have been able to reproduce the bug using steps > that Hao gave in that email:

default partition and concurrent attach partition

2020-09-03 Thread Amit Langote
Hi, Starting a new thread to discuss a bug related to $subject that Hao Wu reported on thread titled "ALTER TABLE .. DETACH PARTITION CONCURRENTLY" [1]. I have been able to reproduce the bug using steps that Hao gave in that email: create table tpart (i int, j int) partition by range(i); create