Re: [sqlsmith] Failed assertion during partition pruning

2021-02-01 Thread David Rowley
On Tue, 2 Feb 2021 at 08:58, Tom Lane wrote: > I renamed things that way, did some more work on the comments, > and pushed it. Thanks for reviewing! Thanks for working on this and coming up with the idea to nuke partitioned_rels. David

Re: [sqlsmith] Failed assertion during partition pruning

2021-02-01 Thread Tom Lane
David Rowley writes: > On Mon, 1 Feb 2021 at 18:57, Tom Lane wrote: >> Oh, it's too late at night. I now remember that the real problem >> I had with that representation was that it cannot work for joinrels. >> Currently we only apply this logic to partitioned baserels, but >> don't you think it

Re: [sqlsmith] Failed assertion during partition pruning

2021-01-31 Thread David Rowley
On Mon, 1 Feb 2021 at 18:57, Tom Lane wrote: > > I wrote: > > David Rowley writes: > >> Parent RT indexes are guaranteed to be lower than their children RT > >> indexes, > > > I was intentionally avoiding that assumption ;-). Maybe it buys enough > > to be worth the loss of generality, but ... >

Re: [sqlsmith] Failed assertion during partition pruning

2021-01-31 Thread Tom Lane
I wrote: > David Rowley writes: >> Parent RT indexes are guaranteed to be lower than their children RT >> indexes, > I was intentionally avoiding that assumption ;-). Maybe it buys enough > to be worth the loss of generality, but ... Oh, it's too late at night. I now remember that the real pro

Re: [sqlsmith] Failed assertion during partition pruning

2021-01-31 Thread Tom Lane
David Rowley writes: > What I can't understand is why you changed to a List-of-Lists rather > than a List-of-Relids. Yeah, I spent no effort on micro-optimizing the data structure. I figured that since we were not including leaf partitions, there would never be enough rels involved to worry abou

Re: [sqlsmith] Failed assertion during partition pruning

2021-01-31 Thread David Rowley
On Sun, 31 Jan 2021 at 11:42, Tom Lane wrote: > > For simplicity of review I divided the patch into two parts. > 0001 revises make_partition_pruneinfo() and children to identify > the relevant parent partitions for themselves, which is not too > hard to do by chasing up the child-to-parent AppendR

Re: [sqlsmith] Failed assertion during partition pruning

2021-01-31 Thread Amit Langote
On Mon, Feb 1, 2021 at 8:50 AM David Rowley wrote: > On Sun, 31 Jan 2021 at 11:42, Tom Lane wrote: > > This fixes the cases reported by Andreas and Jaime, leaving me > > more confident that there's nothing wrong with David's Assert. > > It could be fixed by modifying get_singleton_append_subpath(

Re: [sqlsmith] Failed assertion during partition pruning

2021-01-31 Thread David Rowley
On Sun, 31 Jan 2021 at 11:42, Tom Lane wrote: > This fixes the cases reported by Andreas and Jaime, leaving me > more confident that there's nothing wrong with David's Assert. I agree that there is nothing wrong with the Assert. The commit message of a929e17e5 mentions: > Here we tighten that u

Re: [sqlsmith] Failed assertion during partition pruning

2021-01-30 Thread Tom Lane
I wrote: > As I said, I'm now thinking it's not the Assert that's faulty. > If I'm right about that, it's likely that the mistaken labeling > of these paths has other consequences beyond triggering this > assertion. (If it has none, I think we'd be better off to remove > these Path fields altogeth

Re: [sqlsmith] Failed assertion during partition pruning

2021-01-29 Thread Tom Lane
Zhihong Yu writes: > I wonder if the (failed) assertion should be converted to an if statement: As I said, I'm now thinking it's not the Assert that's faulty. If I'm right about that, it's likely that the mistaken labeling of these paths has other consequences beyond triggering this assertion. (

Re: [sqlsmith] Failed assertion during partition pruning

2021-01-29 Thread Zhihong Yu
Hi, I wonder if the (failed) assertion should be converted to an if statement: diff --git a/src/backend/partitioning/partprune.c b/src/backend/partitioning/partprune.c index fac921eea5..d646f08a07 100644 --- a/src/backend/partitioning/partprune.c +++ b/src/backend/partitioning/partprune.c @@ -585,

Re: [sqlsmith] Failed assertion during partition pruning

2021-01-29 Thread Tom Lane
I wrote: >> What it looks like to me is that the code for setting up run-time >> partition pruning has failed to consider the possibility of nested >> partitioning: it's expecting that every partitioned table will have >> at least one direct child that is a leaf. I'm not sure though >> whether jus

Re: [sqlsmith] Failed assertion during partition pruning

2020-12-01 Thread Tom Lane
I wrote: > What it looks like to me is that the code for setting up run-time > partition pruning has failed to consider the possibility of nested > partitioning: it's expecting that every partitioned table will have > at least one direct child that is a leaf. I'm not sure though > whether just the

Re: [sqlsmith] Failed assertion during partition pruning

2020-11-28 Thread Tom Lane
Andreas Seltenreich writes: > testing master at 3df51ca8 with sqlsmith triggers the following > assertion: > TRAP: FailedAssertion("!bms_is_empty(present_parts)", File: > "partprune.c", Line: 588, PID: 8540) > I looked at a dozen backtraces and they all sport a window aggregate but > that ma

[sqlsmith] Failed assertion during partition pruning

2020-11-28 Thread Andreas Seltenreich
Hi, testing master at 3df51ca8 with sqlsmith triggers the following assertion: TRAP: FailedAssertion("!bms_is_empty(present_parts)", File: "partprune.c", Line: 588, PID: 8540) I looked at a dozen backtraces and they all sport a window aggregate but that may still be random chance since sqls