"Fabre Lambeau" <faml2(at)cam(dot)ac(dot)uk> writes:
> I then tried to add a new record, duplicating another one with both
> contact_validity and contact_principal being 'true' (I changed the
> contact_id, obviously, to avoid duplicate entries in primary key).
> PostgreSQL let me insert it, without raising an error, although the function
> is_principalcontact_unique(actor_id, contacttype_id) now returns 'false'
> Any idea why it is so?
Because the constraint is checked before the row is actually inserted.
regards, tom lane