From: Tom Lane <tgl@sss.pgh.pa.us>
To: dave.bath@unix.net
Cc: pgsql-sql@postgresql.org
Subject: Re: Yes, pg does triggers first before asserting check constraints! Was Re: why vacuum
Date: Wed, 26 Oct 2005 20:55:31 -0400
Message-ID: <13074.1130374531@sss.pgh.pa.us> (raw)
In-Reply-To: <200510271042.11487.dave.bath@unix.net>
References: <200510261015.17623.lawgon@thenilgiris.com>
<200510261622.40874.dave.bath@unix.net>
<2827.1130310024@sss.pgh.pa.us>
<200510271042.11487.dave.bath@unix.net>
"Bath, David" <dave.bath@unix.net> writes:
> you wrote (2005-10-26 17:00)
>>> Sybase/MS-SQL's check constraint model asserts the constraint
>>> BEFORE the trigger, which discourages you from attempting to>
>>> check and handle meaning of data!
>> Er, doesn't PG do it that way too?
> Well, it works for me!
You're right of course. I was confusing this with a related problem
that people occasionally complain about, which is that datatype-related
errors are thrown before the trigger can do anything about them. For
instance, you can't stuff "abc" into a int4 field and hope that the
trigger will have a chance to replace it with something valid. (Yes,
people have asked for that :-() A less silly example is that domain
constraints on a field of a domain type get checked before the trigger
can run.
regards, tom lane
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: tgl@sss.pgh.pa.us, dave.bath@unix.net
Subject: Re: Yes, pg does triggers first before asserting check constraints! Was Re: why vacuum
In-Reply-To: <13074.1130374531@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox