pg12 partitions question - Mailing list pgsql-performance

From Mariel Cherkassky
Subject pg12 partitions question
Date
Msg-id CA+t6e1no0d-1iOCvUhbLYjEyHcX=Ep6XmeCoKuYtc6RvTdmnZg@mail.gmail.com
Whole thread Raw
Responses Re: pg12 partitions question  (Mariel Cherkassky <mariel.cherkassky@gmail.com>)
List pgsql-performance
Hey,
I got the following partitions structure in pg12 beta 3 version : 

postgres=# \d+ students
                            Partitioned table "public.students"
 Column |  Type   | Collation | Nullable | Default | Storage  | Stats target | Description
--------+---------+-----------+----------+---------+----------+--------------+-------------
 id     | integer |           | not null |         | plain    |              |
 name   | text    |           |          |         | extended |              |
 class  | integer |           |          |         | plain    |              |
Partition key: HASH (id)
Indexes:
    "students_pkey" PRIMARY KEY, btree (id)
Foreign-key constraints:
    "students_class_fkey" FOREIGN KEY (class) REFERENCES class(id)
Partitions: students_00 FOR VALUES WITH (modulus 20, remainder 0),
            students_01 FOR VALUES WITH (modulus 20, remainder 1),
            students_02 FOR VALUES WITH (modulus 20, remainder 2),
            students_03 FOR VALUES WITH (modulus 20, remainder 3),
            students_04 FOR VALUES WITH (modulus 20, remainder 4)

postgres=# insert into students values(20,'a',1);
ERROR:  no partition of relation "students" found for row
DETAIL:  Partition key of the failing row contains (id) = (20).


I'm trying to insert a few rows but some of them fail on the following error : no partition of relation "sutdents" found for row ...

for example : 
postgres=# insert into students values(20,'a',1);
ERROR:  no partition of relation "students" found for row
DETAIL:  Partition key of the failing row contains (id) = (20).
postgres=# insert into students values(2,'a',1);
ERROR:  no partition of relation "students" found for row
DETAIL:  Partition key of the failing row contains (id) = (2).
postgres=# insert into students values(1,'a',1);
ERROR:  duplicate key value violates unique constraint "students_00_pkey"
DETAIL:  Key (id)=(1) already exists.
postgres=# insert into students values(2,'a',1);
ERROR:  no partition of relation "students" found for row
DETAIL:  Partition key of the failing row contains (id) = (2).
postgres=# insert into students values(3,'a',1);
INSERT 0 1
postgres=# insert into students values(4,'a',1);
ERROR:  no partition of relation "students" found for row
DETAIL:  Partition key of the failing row contains (id) = (4).

The current content of the table : 
postgres=# select * from students;
 id | name | class
----+------+-------
  1 | a    |     1
  3 | a    |     1
(2 rows)

what am I missing ?


pgsql-performance by date:

Previous
From: MichaelDBA
Date:
Subject: Re: Slow query on a one-tuple table
Next
From: Mariel Cherkassky
Date:
Subject: Re: pg12 partitions question