Re: [GENERAL] Constraint exclusion with box and integer

2011-01-21 Thread Daniele Varrazzo
On Fri, Jan 21, 2011 at 9:11 PM, Jeff Davis wrote: > On Fri, 2011-01-21 at 18:36 +, Daniele Varrazzo wrote: >> => alter table commission_rate add constraint check_overlapping >> exclude using gist (payer_id with =, box( point(extract(epoch from >> start_date), extract(epoch from start_date)),

Re: [GENERAL] Constraint exclusion with box and integer

2011-01-21 Thread Jeff Davis
On Fri, 2011-01-21 at 18:36 +, Daniele Varrazzo wrote: > => alter table commission_rate add constraint check_overlapping > exclude using gist (payer_id with =, box( point(extract(epoch from > start_date), extract(epoch from start_date)), > point(coalesce(extract(epoch from end_date), 'infinity'

Re: [GENERAL] Constraint exclusion with box and integer

2011-01-21 Thread Daniele Varrazzo
On Fri, Jan 21, 2011 at 6:36 PM, Daniele Varrazzo wrote: > All the examples I've found check a record against the whole table. > But in practice I will have a table of resources (hotel rooms, > whatever) and independent periods for each resource. Clarification: I have read the depesz article (ht

[GENERAL] Constraint exclusion with box and integer

2011-01-21 Thread Daniele Varrazzo
Hello, I have the typical problem of overlapping periods exclusion and I'm trying to give constraint exclusion a go as we have recently switched to a PG 9.0 server. All the examples I've found check a record against the whole table. But in practice I will have a table of resources (hotel rooms, w