Re: Transaction Exception Question

From: Martijn van Oosterhout <kleptog(at)svana(dot)org>
To: Jon Swinth <jswinth(at)atomicpc(dot)com>
Cc: "scott(dot)marlowe" <scott(dot)marlowe(at)ihs(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: Transaction Exception Question
Date: 2002-08-14 04:16:07
Message-ID: 20020814141607.A4047@svana.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, Aug 13, 2002 at 10:42:07AM -0700, Jon Swinth wrote:
> Thanks Scott for your reply.
>
> I don't agree that an insert/update/delete error should automatically abort
> the transaction. You have not provided for the fact that the error may be
> handled. I will give you an example that makes my case.
>
> Lets say you have an inventory table. The inventory table has a primary key
> of an integer and a unique key of location and product. The unique key makes
> sure that there is only one record for each product against a single
> location. Now imagine that you have a high volume database with many clients
> and you have a process that attempts to put quantity of a product into a
> location. That process would first select to see if the record already
> existed so it could be update and then insert a row when it wasn't found.
> Now imagine that this is just part of a long running transaction and that
> multiple clients will want to put more of the same product in the same
> location.

Quick question (maybe I'm misunderstanding something) but why are all these
unrelated queries all in the same transaction? If you commited between each
update your problem goes away.

What you are trying to do could be acheived using using LOCKs but you don't
want that.

--
Martijn van Oosterhout <kleptog(at)svana(dot)org> http://svana.org/kleptog/
> There are 10 kinds of people in the world, those that can do binary
> arithmetic and those that can't.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Christopher Kings-Lynne 2002-08-14 04:37:56 tsearch vs. fulltextindex
Previous Message Emmanuel Charpentier 2002-08-13 23:04:06 Re: Blob stuff