Subject Re: [firebird-support] Re: Checking periods don't overlap
Author Brian L. Juergensmeyer
Ann W. Harrison wrote:
// Snip
>
> 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
>
> I foolishly thought that check constraints were evaluated
> in system context. Sadly, it seems not. Would someone with
> access to InterBase 7+ (or 7) check its behavior?

On Interbase 7.1 SP 2, I can confirm exactly the behaviour you describe.
Under IBConsole, I created the table and ran the initial insert.
Before committing, I opened up a command prompt and ran isql. From
there, ran the second query.

The select shows TEST:
F1
============

1
1

Brian