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

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Stefan <sb(at)drbott(dot)de>, pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #5081: ON INSERT rule does not work correctly
Date: 2009-09-27 13:46:03
Message-ID: 603c8f070909270646l1620fc93x9102651da59c5d5d@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Sat, Sep 26, 2009 at 12:35 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> "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.

I'm confused. DO INSTEAD doesn't mean DO INSTEAD?

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

I'm not sure you can make it reliable though.

...Robert

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2009-09-27 15:36:45 Re: BUG #5081: ON INSERT rule does not work correctly
Previous Message Tom Lane 2009-09-27 04:59:11 Re: BUG #5079: postgres killed by signal 11 when executing xslt_process function from xml2 contrib module.