Re: "on insert" rules happen before the insert?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: treat00(at)yahoo(dot)com (Thomas Reat)
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: "on insert" rules happen before the insert?
Date: 2004-01-05 05:26:54
Message-ID: 21896.1073280414@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

treat00(at)yahoo(dot)com (Thomas Reat) writes:
> The postgresql documentation claims that "on insert" rules are executed
> after the insert. This is not happening for me. I have a rule that is being
> executed even though the insert should have failed due to a foreign key check.

The INSERT certainly happens before any rules that it triggers. But
foreign key checks probably don't happen until all the dust has settled.
This is arguably not a bug --- there are situations where it's essential.

regards, tom lane

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Kumar 2004-01-05 11:04:38 Virtual records
Previous Message Iain 2004-01-05 01:40:13 Re: not in vs not exists - vastly diferent performance