Re: [SQL] insert or update within transaction

2011-09-17 Thread Josh Kupershmidt
On Sat, Sep 17, 2011 at 10:52 AM, Andreas wrote: > Instead of the update the query fails with an double key value error for the > primary key. > Shouldn't the insert fail, get rolled back and then exercute an update > instead successfully? Yes, and that is indeed what I see when I run your exampl

Re: [SQL] INSERT or UPDATE

2008-08-18 Thread A. Kretschmer
am Mon, dem 18.08.2008, um 9:44:48 +0200 mailte Andreas Kraftl folgendes: > But there is also the possibility, that one row is available. Means that > i need an UPDATE instead of the INSERT. > > Is it in SQL possible to decide if there is an UPDATE or an INSERT or > must i program something with

Re: [SQL] insert or update violates foreign key constraint.why?

2004-05-31 Thread Tom Lane
Oleg Mayevskiy <[EMAIL PROTECTED]> writes: > it seems to be a simple problem, but it is not. Yes it is ... you're expecting the RI triggers to fire during the plpgsql function, but in fact they fire at completion of the outer statement that called the plpgsql function. There's been some debate ab