pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Andreas Seltenreich <seltenreich@gmx.de>
Cc: pgsql-hackers@lists.postgresql.org
Subject: Re: [sqlsmith] Failed assertion during partition pruning
Date: Sat, 28 Nov 2020 17:52:28 -0500
Message-ID: <919903.1606603948@sss.pgh.pa.us> (raw)
In-Reply-To: <87sg8tqhsl.fsf@aurora.ydns.eu>
References: <87sg8tqhsl.fsf@aurora.ydns.eu>

Andreas Seltenreich <seltenreich@gmx.de> 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 may still be random chance since sqlsmith really likes generating
> these a lot...

Yeah, it doesn't seem to need a window aggregate:

regression=# select a from trigger_parted where pg_trigger_depth() <> a order by a limit 40;
server closed the connection unexpectedly

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 Assert is wrong, or there's more fundamental
issues here.

It's also somewhat interesting that you need the "order by a limit 40"
to get a crash.  Poking around in the failing backend, I can see that
that causes the leaf-partition subplan to be an indexscan not a seqscan,
but it's far from clear why that'd make any difference to the partition
pruning logic.

			regards, tom lane





view thread (15+ messages)  latest in thread

Message-ID: <919903.1606603948@sss.pgh.pa.us>
Permalink:  ../919903.1606603948@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/919903.1606603948@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-hackers@postgresql.org
  Cc: tgl@sss.pgh.pa.us, seltenreich@gmx.de
  Subject: Re: [sqlsmith] Failed assertion during partition pruning
  In-Reply-To: <919903.1606603948@sss.pgh.pa.us>
  References: <87sg8tqhsl.fsf@aurora.ydns.eu> <919903.1606603948@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox