pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: michalalbrycht@gmail.com
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #16840: Rows not found in table partitioned by hash when not all partitions exists
Date: Wed, 27 Jan 2021 13:08:34 -0500
Message-ID: <2407555.1611770914@sss.pgh.pa.us> (raw)
In-Reply-To: <16840-571a22976f829ad4@postgresql.org>
References: <16840-571a22976f829ad4@postgresql.org>

PG Bug reporting form <noreply@postgresql.org> writes:
> CREATE TABLE dir (
>    id SERIAL,
>    volume_id BIGINT,
>    path TEXT
> ) PARTITION BY HASH (volume_id);
> CREATE TABLE  dir_part_2 PARTITION OF dir FOR VALUES WITH (modulus 3,
> remainder 2);
> SELECT * FROM dir WHERE volume_id=1 AND (path='abc' OR path='def')  --
> returns 0 rows - NOT OK!

Hmm, seems to be a case of faulty partition exclusion, because the
plan isn't scanning anything:

=# explain SELECT * FROM dir WHERE volume_id=1 AND (path='abc' OR path='def');
                QUERY PLAN                
------------------------------------------
 Result  (cost=0.00..0.00 rows=0 width=0)
   One-Time Filter: false
(2 rows)

Probably the reason we'd not noticed is that an incomplete set of
hash partitions isn't a very useful situation: if you don't
populate all of the partitions, you risk unexpected insertion
failures, since you really shouldn't be assuming which partition
any given key value will map into.  Still, it's clearly a bug.
Thanks for the report!

			regards, tom lane





view thread (6+ messages)  latest in thread

Message-ID: <2407555.1611770914@sss.pgh.pa.us>
Permalink:  ../2407555.1611770914@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/2407555.1611770914@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 using the --to and --cc options:
  reply via email

  To: pgsql-bugs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, michalalbrycht@gmail.com, pgsql-bugs@lists.postgresql.org
  Subject: Re: BUG #16840: Rows not found in table partitioned by hash when not all partitions exists
  In-Reply-To: <2407555.1611770914@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