On Postgres 11 have this simple table and partition definition
ap=# \d+ hp
Partitioned table "public.hp"
Column | Type | Collation | Nullable | Default | Storage | Stats target | Description
--------+--------+-----------+----------+---------+---------+--------------+-------------
foo | bigint | | | | plain | |
Partition key: HASH (foo)
Partitions: hp_0 FOR VALUES WITH (modulus 10, remainder 0),
hp_1 FOR VALUES WITH (modulus 10, remainder 1),
hp_2 FOR VALUES WITH (modulus 10, remainder 2),
hp_3 FOR VALUES WITH (modulus 10, remainder 3),
hp_4 FOR VALUES WITH (modulus 10, remainder 4),
hp_5 FOR VALUES WITH (modulus 10, remainder 5),
hp_6 FOR VALUES WITH (modulus 10, remainder 6),
hp_7 FOR VALUES WITH (modulus 10, remainder 7),
hp_8 FOR VALUES WITH (modulus 10, remainder 8),
hp_9 FOR VALUES WITH (modulus 10, remainder 9)
Inserting into this table a value of 14 and checking on the partition it lands in
insert into hp values(14);
SELECT tableoid::regclass,* FROM hp;
tableoid | foo
----------+-----
hp_0 | 14
(1 row)
Not able to explain how 14 lands in partition hp_0. From what I gather the hash function for bigint is hashint8
ap=# select hashint8(14);
hashint8
-------------
-1018458207
(1 row)
-1018458207 mod 10 would be -7
-1018458207 converted to unsigned int and mod 10 ==> 3276509089 mod 10 = 9
So unable to see how it lands in hp_0 which is for the remainder 0.