Re: pg12 partitions question

From: Mariel Cherkassky <mariel(dot)cherkassky(at)gmail(dot)com>
To: PostgreSQL mailing lists <pgsql-performance(at)postgresql(dot)org>
Subject: Re: pg12 partitions question
Date: 2019-09-23 11:02:10
Message-ID: CA+t6e1=L9wrKFVGFx1Ko33S=kT-VFL7z1Cw-3iqv7waqWOPO6Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

I understood my problem. thanks.

‫בתאריך יום ב׳, 23 בספט׳ 2019 ב-13:59 מאת ‪Mariel Cherkassky‬‏ <‪
mariel(dot)cherkassky(at)gmail(dot)com‬‏>:‬

> 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 ?
>
>
>

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Luís Roberto Weck 2019-09-23 18:42:05 Slow query on V12.
Previous Message Mariel Cherkassky 2019-09-23 10:59:40 pg12 partitions question