Re: Trigger function is not called - Mailing list pgsql-general

From Tom Lane
Subject Re: Trigger function is not called
Date
Msg-id 18430.1219721893@sss.pgh.pa.us
Whole thread Raw
In response to Trigger function is not called  (Bill <pg@dbginc.com>)
List pgsql-general
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

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: Trigger function is not called
Next
From: Vishal Arora
Date:
Subject: Re: [ADMIN] Regarding access to a user