Oddity in COPY FROM handling of check constraints on partition tables
Вложения
В списке pgsql-hackers по дате отправления:
| От | Etsuro Fujita |
|---|---|
| Тема | Oddity in COPY FROM handling of check constraints on partition tables |
| Дата | |
| Msg-id | 5ABA4074.1090500@lab.ntt.co.jp обсуждение исходный текст |
| Ответы |
Re: Oddity in COPY FROM handling of check constraints on partitiontables
Re: Oddity in COPY FROM handling of check constraints on partition tables |
| Список | pgsql-hackers |
Hi, While updating the tuple-routing-for-foreign-partitions patch, I noticed oddity in the COPY FROM handling of check constraints on partition tables. Here is an example: postgres=# create table pt (a int, b int) partition by list (a); CREATE TABLE postgres=# create table p1 partition of pt for values in (1); CREATE TABLE postgres=# alter table p1 add check (b > 0); ALTER TABLE postgres=# copy pt from '/home/pgsql/copy_data.csv' (format csv, delimiter ','); COPY 1 postgres=# select tableoid::regclass, * from pt; tableoid | a | b ----------+---+---- p1 | 1 | -1 (1 row) where the file '/home/pgsql/copy_data.csv' has a single row data $ cat /home/pgsql/copy_data.csv 1,-1 which violates the constraint on the column b (ie, b > 0), so this should abort. The reason for that is because CopyFrom looks at the parent relation's constraints, not the partition's constraints, when checking the constraint against the input row. Attached is a patch for fixing this issue. Best regards, Etsuro Fujita
В списке pgsql-hackers по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера