Subject | Re: CHECK Constraints (was: Re: [firebird-support] Re: Checking periods don't overlap) |
---|---|
Author | Martijn Tonies |
Post date | 2004-06-15T15:01:25Z |
Hi John,
same goes for the thing you put up at Sourceforge --
We were using "new.<column>" - now, this works, because
internally, a CHECK constraint gets implemented as two
triggers (BEFORE UPDATE and INSERT). Nevertheless,
I think this is the wrong approach and you should be able
to construct a valid constraint for a row without the NEW
thingy...
Something like:
not exists(select * from mytable
where mytable.pkcol <> current.pkcol
and mytable.uniquecol = current.uniquecol)
This is a different constraint that with the NEW thingy.
With regards,
Martijn Tonies
Database Workbench - developer tool for InterBase, Firebird, MySQL & MS SQL
Server.
Upscene Productions
http://www.upscene.com
> My point is that check constraints should work in a way consistentIn the case that both of use tried, things are a bit different. The
> with indexes, which at the moment they don't.
same goes for the thing you put up at Sourceforge --
We were using "new.<column>" - now, this works, because
internally, a CHECK constraint gets implemented as two
triggers (BEFORE UPDATE and INSERT). Nevertheless,
I think this is the wrong approach and you should be able
to construct a valid constraint for a row without the NEW
thingy...
Something like:
not exists(select * from mytable
where mytable.pkcol <> current.pkcol
and mytable.uniquecol = current.uniquecol)
This is a different constraint that with the NEW thingy.
With regards,
Martijn Tonies
Database Workbench - developer tool for InterBase, Firebird, MySQL & MS SQL
Server.
Upscene Productions
http://www.upscene.com