From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Klint Gore <kgore4(at)une(dot)edu(dot)au> |
Cc: | Bill <pg(at)dbginc(dot)com>, PgSQL General <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Trigger function is not called |
Date: | 2008-08-26 03:38:13 |
Message-ID: | 18430.1219721893@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Klint Gore <kgore4(at)une(dot)edu(dot)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
From | Date | Subject | |
---|---|---|---|
Next Message | Bill | 2008-08-26 03:43:06 | Re: Trigger function is not called |
Previous Message | Klint Gore | 2008-08-26 03:24:34 | Re: Trigger function is not called |