pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Daniel Westermann <daniel.westermann@dbi-services.com>
To: pgsql-general <pgsql-general@postgresql.org>
Subject: PG11 Hash partitioning and null values in the partition key
Date: Fri, 13 Jul 2018 16:05:26 +0200 (CEST)
Message-ID: <1001533186.34186.1531490726446.JavaMail.zimbra@dbi-services.com> (raw)

Hi, 

given this setup: 

create table part2 ( a int, list varchar(10) ) partition by hash (a); 
create table part2_1 partition of part2 FOR VALUES WITH (MODULUS 3, REMAINDER 0); 
create table part2_2 partition of part2 FOR VALUES WITH (MODULUS 3, REMAINDER 1); 
create table part2_3 partition of part2 FOR VALUES WITH (MODULUS 3, REMAINDER 2); 

insert into part2 (a,list) values (1,'aaa'); 
insert into part2 (a,list) values (2,'bbb'); 
insert into part2 (a,list) values (3,'ccc'); 

... it is possible to insert rows like this which will always go to the first partition: 

insert into part2 (a,list) values (null,'ddd'); 
insert into part2 (a,list) values (null,'eee'); 
select * from part2_1; 
a | list 
---+------ 
2 | bbb 
| ddd 
| eee 
(3 rows) 

I suppose this is intended but I could not find anything in the documentation about that. Can someone please clarify the logic behind that? 

Thanks in advance 
Daniel 

view thread (3+ messages)  latest in thread

Message-ID: <1001533186.34186.1531490726446.JavaMail.zimbra@dbi-services.com>
Permalink:  ../1001533186.34186.1531490726446.JavaMail.zimbra@dbi-services.com/
Also on:    postgresql.org/message-id/1001533186.34186.1531490726446.JavaMail.zimbra@dbi-services.com

 · 

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-general@postgresql.org
  Cc: daniel.westermann@dbi-services.com
  Subject: Re: PG11 Hash partitioning and null values in the partition key
  In-Reply-To: <1001533186.34186.1531490726446.JavaMail.zimbra@dbi-services.com>
  References: <1001533186.34186.1531490726446.JavaMail.zimbra@dbi-services.com>

* 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