Re: pg12 partitions question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I understood my problem. thanks.

‫בתאריך יום ב׳, 23 בספט׳ 2019 ב-13:59 מאת ‪Mariel Cherkassky‬‏ <‪mariel.cherkassky@xxxxxxxxx‬‏>:‬
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 ?



[Postgresql General]     [Postgresql PHP]     [PHP Users]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Yosemite]

  Powered by Linux