Subject Re: Checking periods don't overlap
Author johnsparrowuk
Yes! If you can select it in your own transaction, the check
constraint can see it too.



--- In firebird-support@yahoogroups.com, Lester Caine <lester@l...>
wrote:
> Ann W. Harrison wrote:
>
> > Perhaps someone will explain what's wrong with this picture,
> > but here's the script.
> >
> > create table test (f1 integer not null);
> > alter table test add constraint dumb check (
> > not exists (select x.* from test x where x.f1 = new.f1));
> > commit;
> >
> > insert into test (f1) values (1);
> >
> > OK hold that thought. Now from another process:
> >
> > insert into test (f1) values (1);
> > commit;
> >
> > Now back to the first process:
> >
> > commit;
> > select * from test;
> >
> > F1
> > ============
> >
> > 1
> > 1
>
> Silly question - I presume that a third attempt at the insert does
> actually fail :)
>
> --
> Lester Caine
> -----------------------------
> L.S.Caine Electronic Services