Re: transaction aborted, queries ignored - Mailing list pgsql-general

From Hilmar Lapp
Subject Re: transaction aborted, queries ignored
Date
Msg-id 82193DE8D6533A4C935DC1D629E3B8052A170C@EXCHCLUSTER01.lj.gnf.org
Whole thread Raw
List pgsql-general

> -----Original Message-----
> From: Alvaro Herrera [mailto:alvherre@dcc.uchile.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
knownto most parts of the library because it is abstracted from the schema. It is possible to go that route, but it
willbe 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

pgsql-general by date:

Previous
From: Jean-Luc Lachance
Date:
Subject: Re: Turning off triggers ?
Next
From: Felipe Schnack
Date:
Subject: encoding...