Christian Rank <christian.rank@rz.uni-passau.de> writes: > ... according to the docs, the validity of a constraint should be > checked after each statement unless this behaviour is altered with a SET > CONSTRAINTS statement. "Statement" means "interactive command" in that context --- in other words, the constraints won't be checked until after control returns from your function. regards, tom lane ---------------------------(end of broadcast)--------------------------- TIP 5: Have you checked our extensive FAQ? http://www.postgresql.org/docs/faqs/FAQ.html