> I don't see any bug here; it's just that CHECK constraints are applied > after any BEFORE triggers are run. Since the triggers could change the > data to be inserted, the reverse order would be insecure.
Ups, it did make some false assumptions. Thank you for the clarification. If I understood now correctly, first the type, then the trigger and last the check constraint is checked. This makes it also impossible to change the type of a value by a trigger? Say I would want to change the input of a user to a date, this wouldn't be possible, because in first instance the type is not a date. Here is an example I tried out: CREATE TABLE test(datum DATE); CREATE OR REPLACE FUNCTION function_test() RETURNS trigger AS 'BEGIN new.datum := (''15.06.'' || new.datum)::date; RETURN new; END;' LANGUAGE plpgsql; CREATE TRIGGER trigger_test BEFORE INSERT OR UPDATE ON test FOR EACH ROW EXECUTE PROCEDURE function_test(); INSERT INTO test VALUES('2003'); Best regards, Daniel -- Retrovirology Laboratory Luxembourg Centre Hospitalier de Luxembourg 4, rue E. Barblé L-1210 Luxembourg phone: +352-44116105 fax: +352-44116113 web: http://www.retrovirology.lu e-mail: [EMAIL PROTECTED] ---------------------------(end of broadcast)--------------------------- TIP 7: don't forget to increase your free space map settings