Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fdyhW-0000VT-8U for pgsql-general@arkaria.postgresql.org; Fri, 13 Jul 2018 14:05:38 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fdyhU-0004lu-Dy for pgsql-general@arkaria.postgresql.org; Fri, 13 Jul 2018 14:05:36 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fdyhR-0004Rr-0t for pgsql-general@lists.postgresql.org; Fri, 13 Jul 2018 14:05:33 +0000 Received: from mail.dbi-services.com ([195.70.1.167] helo=33229-ml-01.dfinet.ch) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fdyhN-0007zN-AW for pgsql-general@postgresql.org; Fri, 13 Jul 2018 14:05:31 +0000 Received: from 33229-ml-01.dfinet.ch (localhost [127.0.0.1]) by 33229-ml-01.dfinet.ch (Postfix) with ESMTPS id B9847CF77402 for ; Fri, 13 Jul 2018 16:05:26 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by 33229-ml-01.dfinet.ch (Postfix) with ESMTP id ABD76CF7741F for ; Fri, 13 Jul 2018 16:05:26 +0200 (CEST) X-Virus-Scanned: amavisd-new at 33229-ml-01.dfinet.ch Received: from 33229-ml-01.dfinet.ch ([127.0.0.1]) by localhost (33229-ml-01.dfinet.ch [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id 5v8sDJ5U6Mtt for ; Fri, 13 Jul 2018 16:05:26 +0200 (CEST) Received: from 33229-ml-01.dfinet.ch (33229-ml-01.dfinet.ch [10.128.30.2]) by 33229-ml-01.dfinet.ch (Postfix) with ESMTP id 95829CF77402 for ; Fri, 13 Jul 2018 16:05:26 +0200 (CEST) Date: Fri, 13 Jul 2018 16:05:26 +0200 (CEST) From: Daniel Westermann To: pgsql-general Message-ID: <1001533186.34186.1531490726446.JavaMail.zimbra@dbi-services.com> Subject: PG11 Hash partitioning and null values in the partition key MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="=_d1d507ae-fe2f-47dd-8006-484a9f930fa5" X-Originating-IP: [46.140.36.2] X-Mailer: Zimbra 8.8.7_GA_1964 (ZimbraWebClient - FF61 (Linux)/8.8.7_GA_1964) Thread-Index: +0QheeLj13MezX5CCLPNcqlgvuaeHg== Thread-Topic: PG11 Hash partitioning and null values in the partition key List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --=_d1d507ae-fe2f-47dd-8006-484a9f930fa5 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit 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 --=_d1d507ae-fe2f-47dd-8006-484a9f930fa5 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable
Hi,

given this setup:

create table part2 ( a int, list varchar(10) ) parti= tion by hash (a);
create table part2_1 p= artition 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 int= o part2 (a,list) values (1,'aaa');
inser= t 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 partit= ion:

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

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

Thanks = in advance
Daniel

--=_d1d507ae-fe2f-47dd-8006-484a9f930fa5--