Re: constraint checking on partitions
От | Tom Lane |
---|---|
Тема | Re: constraint checking on partitions |
Дата | |
Msg-id | 5053.1247166544@sss.pgh.pa.us обсуждение исходный текст |
Ответ на | Re: constraint checking on partitions ("Chris Spotts" <rfusca@gmail.com>) |
Ответы |
Re: constraint checking on partitions
|
Список | pgsql-general |
"Chris Spotts" <rfusca@gmail.com> writes: > I mistyped, that should be > alter table D add constraint onlyjuly check (date1 >= '2009-07-01' and date1 > < '2009-08-01') > Then this is also run > alter table O add constraint notjuly check (NOT(date1 >= '2009-07-01' and > date1 < '2009-08-01')) > If I ran a select * from A where date1 >= '2009-07-02' and date1 < > '2009-07-15' then I would think it wouldn't check O. Works for me ... regression=# create table a (date1 date); CREATE TABLE regression=# create table july() inherits(a); CREATE TABLE regression=# create table other() inherits(a); CREATE TABLE regression=# alter table other add constraint notjuly check (NOT(date1 >= '2009-07-01' and date1 < '2009-08-01')); ALTER TABLE regression=# explain select * from a where date1 >= '2009-07-02' and date1 < '2009-07-15'; QUERY PLAN ---------------------------------------------------------------------------------------- Result (cost=0.00..92.00 rows=24 width=4) -> Append (cost=0.00..92.00 rows=24 width=4) -> Seq Scan on a (cost=0.00..46.00 rows=12 width=4) Filter: ((date1 >= '2009-07-02'::date) AND (date1 < '2009-07-15'::date)) -> Seq Scan on july a (cost=0.00..46.00 rows=12 width=4) Filter: ((date1 >= '2009-07-02'::date) AND (date1 < '2009-07-15'::date)) (6 rows) regression=# regards, tom lane
В списке pgsql-general по дате отправления: