Skip site navigation (1) Skip section navigation (2)

Re: BUG #5081: ON INSERT rule does not work correctly

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Stefan" <sb(at)drbott(dot)de>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #5081: ON INSERT rule does not work correctly
Date: 2009-09-26 16:35:18
Message-ID: 22436.1253982918@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-bugs
"Stefan" <sb(at)drbott(dot)de> writes:
> The problem is that if it is no record in the table, it seems that first the
> INSERT command is issued and after that the UPDATE command is issued, too.

Well, yeah.  That's exactly how it's documented to work: an ON INSERT
rule is executed after the INSERT proper.

You could maybe make this work with a BEFORE INSERT trigger.

			regards, tom lane

In response to

Responses

pgsql-bugs by date

Next:From: Tom LaneDate: 2009-09-27 04:31:04
Subject: Re: BUG #5076: LEFT OUTER JOIN and WHERE madness
Previous:From: Kris JurkaDate: 2009-09-26 14:32:19
Subject: Re: [JDBC] BUG #5058: [jdbc] Silent failure with executeUpdate()

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group