On Wed, 2011-01-19 at 10:15 -0500, Daniel Popowich wrote:
> Anyway...Jeff, all your answers depend on using new features in 9.0.
> What would you recommend for folk still using 8.4? Without 9.0
> exclusion constraints, what else can you do besides using functions in
> check constraints (or trigger
Jeff Davis writes:
> On Sat, 2011-01-15 at 21:32 +0100, Tomas Vondra wrote:
> > > ALTER TABLE event ADD CONSTRAINT event_overlap
> > > CHECK(overlap_at_dest(destination_id, starts, ends));
> >
> > There's a race condition
>
> ...
>
> > One way to fix this is locking
>
> I do
On Sat, 2011-01-15 at 21:32 +0100, Tomas Vondra wrote:
> > ALTER TABLE event ADD CONSTRAINT event_overlap
> > CHECK(overlap_at_dest(destination_id, starts, ends));
>
> There's a race condition
...
> One way to fix this is locking
I do not recommend locking. In fact, the prima
On Sat, 2011-01-15 at 15:07 -0500, Daniel Popowich wrote:
> Constraint expressions can only be simple boolean expressions, so can
> refer only to the column(s) of the current row you're
> inserting/updating,
Exclusion Constraints are a new feature in 9.0:
http://www.postgresql.org/docs/9.0/stati
On Sat, 2011-01-15 at 19:17 +, Matthew Wilson wrote:
> create table event(
>
> destination_id integer not null references destination
> (destination_id),
>
> starts timestamp,
> ends timestamp
> );
>
> I want to make sure that no two rows **with the same destination_id**
> ov
Matthew Wilson wrote:
> I have a table like this:
>
> create table event(
>
> destination_id integer not null references destination
> (destination_id),
>
> starts timestamp,
> ends timestamp
> );
>
> I want to make sure that no two rows **with the same destination_id**
> over
Dne 15.1.2011 21:07, Daniel Popowich napsal(a):
> CREATE OR REPLACE FUNCTION overlap_at_dest(dest integer,
> s timestamp,
> e timestamp)
> returns boolean as $_$
Matthew Wilson writes:
> I have a table like this:
>
> create table event(
>
> destination_id integer not null references destination
> (destination_id),
>
> starts timestamp,
> ends timestamp
> );
>
> I want to make sure that no two rows **with the same destination_id**
> over