HASH partitioning not working properly - Mailing list pgsql-general

From Srinivasa T N
Subject HASH partitioning not working properly
Date
Msg-id CAFruNddApLqb36oUVyHr1BhnN1he1yWUpzqgrT0gPYL_mufB4A@mail.gmail.com
Whole thread Raw
Responses Re: HASH partitioning not working properly  (David Rowley <dgrowleyml@gmail.com>)
List pgsql-general
Hi,
   After seeing the below, I feel partitioning is not working properly or it maybe case that my understanding is wrong.  Can somebody explain me what is happening?

postgres=# create table busbar_version (objectid int, ver_id int) partition by hash(ver_id);
CREATE TABLE
postgres=# CREATE TABLE busbar_version0 PARTITION OF busbar_version FOR VALUES WITH (MODULUS 10, REMAINDER 0);
CREATE TABLE
postgres=# CREATE TABLE busbar_version5 PARTITION OF busbar_version FOR VALUES WITH (MODULUS 10, REMAINDER 5);
CREATE TABLE
postgres=# CREATE TABLE busbar_version6 PARTITION OF busbar_version FOR VALUES WITH (MODULUS 10, REMAINDER 6);
CREATE TABLE
postgres=# CREATE TABLE busbar_version7 PARTITION OF busbar_version FOR VALUES WITH (MODULUS 10, REMAINDER 7);
CREATE TABLE

I did insert using following:

postgres=# insert into busbar_version(objectid,ver_id) values (5,5);
INSERT 0 1
postgres=# insert into busbar_version(objectid,ver_id) values (6,6);
INSERT 0 1

I was of the opinion that the above rows were inserted into busbar_version5 and busbar_version6, but I'm wrong.

postgres=# select * from busbar_version;
 objectid | ver_id
----------+--------
        5 |      5
        6 |      6
(2 rows)

postgres=# select * from busbar_version5;
 objectid | ver_id
----------+--------
        5 |      5
(1 row)

postgres=# select * from busbar_version6;
 objectid | ver_id
----------+--------
(0 rows)

postgres=# select * from busbar_version7;
 objectid | ver_id
----------+--------
        6 |      6
(1 row)

   Why second insert has gone to table busbar_version7 instead of busbar_version6?  

If it helps, I am trying on the "psql (12.3 (Debian 12.3-1.pgdg100+1))" container.

Regards,
Seenu.

pgsql-general by date:

Previous
From: Paul Förster
Date:
Subject: Re: Netapp SnapCenter
Next
From: Kyotaro Horiguchi
Date:
Subject: Re: Conflict with recovery on PG version 11.6