Subject Re: Re[2]: [firebird-support] Re: Checking periods don't overlap
Author Martijn Tonies
Hi Nando,

> MT> Perhaps this is one of those that needs a "deferred" constraint?
>
> as Peter has also suggested, this would help with the your "unique"
> simulation.

Yes, seems we got the same idea :-)

>I'm not sure it would cover the overlapped periods case.
> Personally, I am more keen to support the addition of deferred
> constraints than triggers in system transaction context.

Oh, indeed. IMO, there shouldn't be a "system transaction context"
for user written code.

There should be constraints though that can enforce my example.

On the other hand - I wonder what goes wrong.

In my example, I wrote WHERE ... <> NEW.<column>

Now, this "new" part could be the problem. You don't only
want this constraint enforced for new values/records, but for
all existing records as well. But with Firebird, there seems to
be something wrong when writing table/database CHECK
constraints and addressing the current table. Perhaps this has
to do with the aliassing and still being able to address the table
without the alias in a SQL statement?

With regards,

Martijn Tonies
Database Workbench - developer tool for InterBase, Firebird, MySQL & MS SQL
Server.
Upscene Productions
http://www.upscene.com