Klint Gore <kgore4@une.edu.au> writes:
> ... With the not null definition in the domain, this
> blows up before anything else has a chance.
Right. Forming the proposed row-to-insert involves coercing the data to
the correct data types, and for domain types enforcing the domain
constraints is seen as part of that. So you can't use a trigger to
clean up problems that violate the column's datatype definition.
However, constraints associated with the *table* (such as a NOT NULL
column constraint in the table definition) are enforced only after the
before-trigger(s) fire. So you could use a table constraint to backstop
something you're expecting a trigger to enforce.
This difference is probably what's confusing Bill, and I didn't help any
by giving wrong information about it just now. Sorry again.
regards, tom lane