Re: transaction aborted, queries ignored

From: "Hilmar Lapp" <hlapp(at)gnf(dot)org>
To: "Alvaro Herrera" <alvherre(at)dcc(dot)uchile(dot)cl>
Cc: <pgsql-general(at)postgresql(dot)org>
Subject: Re: transaction aborted, queries ignored
Date: 2002-11-25 18:47:35
Message-ID: 82193DE8D6533A4C935DC1D629E3B8052A170C@EXCHCLUSTER01.lj.gnf.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

> -----Original Message-----
> From: Alvaro Herrera [mailto:alvherre(at)dcc(dot)uchile(dot)cl]
> Sent: Monday, November 25, 2002 7:56 AM
> To: Hilmar Lapp
> Subject: Re: [GENERAL] transaction aborted, queries ignored
>
>
> On Mon, Nov 25, 2002 at 12:23:22AM -0800, Hilmar Lapp wrote:
>
> Hi,
>
> > Apart from turning off transactions (which would have other
> > detrimental effects), the only work-around seems to me to rewrite
> > the code flow such that a look-up is issued before any
> insert. Since
> > for the overwhelming majority of those inserts there would be no UK
> > violation, adding a extra look-up seems also potentially expensive
> > to me.
>
> I'd say go with this solution. Try to encapsulate it on a function,
> however; you call the function just as you would call the INSERT, but
> the function executes the SELECT and just INSERT if no tuple is found.
>
> Given that you know the primary key in advance, the lookup should be
> relatively inexpensive.

Well, I don't know the primary key really. Rather, the primary key is a compound key the components of which aren't known to most parts of the library because it is abstracted from the schema. It is possible to go that route, but it will be painful and require some major code rewrite.

>
> The feature you need is nested transactions.

Absolutely right. (Although I don't believe InnoDB can pride themselves with having nested transactions.)

> That is being worked on
> for 7.4, but it is several months away.

A pity (for me, anyway) it's not there yet, but absolutely cool that it is being worked on.

Thank you for your help.

-hilmar

Browse pgsql-general by date

  From Date Subject
Next Message Felipe Schnack 2002-11-25 18:51:19 encoding...
Previous Message Jean-Luc Lachance 2002-11-25 16:41:51 Re: Turning off triggers ?