Hmm. But what I proposed was that normally (initially) when a
transaction starts
the checks are immediate
CHECKS_DEFERRED = FALSE
With SET CHECKS_DEFERRED TRUE one can make them deferred for the
lifetime of that connection.
What Postgresql adds to this is an extra layer of complexity:
A way to define for foreign key constraints whether they are initially
in DEFERRED or IMMEDIATE mode.
So simply setting a default value.
Well, to be fair the always NOT DEFERRABLE allows for foreign keys that
can not be deferred
(why would someone want this?)
But there is a clear blunder that Postgresql has in it's constraint
implementation.
It does not treat all constraints uniformly.
Quote:
"Compatibility
This command complies with the behavior defined in the SQL standard,
except for the limitation that, in PostgreSQL, it does not apply to NOT
NULL and CHECK constraints. Also, PostgreSQL checks non-deferrable
uniqueness constraints immediately, not at end of statement as the
standard would suggest."
Who would like to say in his tables definition:
COLUMN INTEGER NOT NULL DEFERRABLE INITIALLY DEFERRED UNIQUE DEFERRABLE
INITIALLY IMMEDIATE PRIMARY KEY NOT DEFERRABLE REFERENCES FOO(x)
DEFERRABLE INITIALLY DEFERRED ON UPDATE RESTRICT ON DELETE CASCADE
?!?
Most important is that we treat all the constraints in the same manner.
I have nothing against the ability to set default values to constraints
but to me it seems that the crucial feature is the construct
SET CONSTRAINTS { ALL | /name/ [, ...] } { DEFERRED | IMMEDIATE }
The rest is building some extra features on top of that fundamental feature.
- Rami
Sergi Vladykin wrote:
Hi,
I agree with Dario, that "fail fast" behavior is more appropriate in
the majority of cases, so making all the checks deffered is not a good
idea.
Better to do this in a Postgresql way
http://www.postgresql.org/docs/9.0/interactive/sql-set-constraints.html
regards,
Sergi
--
You received this message because you are subscribed to the Google Groups "H2
Database" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/h2-database?hl=en.