Re: Revisited: Transactions, insert unique. - Mailing list pgsql-general

From davidb@vectormath.com
Subject Re: Revisited: Transactions, insert unique.
Date
Msg-id 008101bfadfe$b4d79930$0602010a@bullwinkle.vectormath
Whole thread Raw
In response to Revisited: Transactions, insert unique.  (Lincoln Yeoh <lylyeoh@mecomb.com>)
Responses Re: Revisited: Transactions, insert unique.  (Joachim Achtzehnter <joachim@kraut.bc.ca>)
Re: Revisited: Transactions, insert unique.  (Lincoln Yeoh <lylyeoh@mecomb.com>)
List pgsql-general
Hi Lincoln,

I'm not sure I'm understanding your question, but it seems like this is
something that
ought to be handled programmatically.  That is, query the table to see if
the row exists,
then decide what you are going to do (insert or update) based on the results
of your
query.

Am I completely missing the point?

David Boerwinkle

-----Original Message-----
From: Lincoln Yeoh <lylyeoh@mecomb.com>
To: pgsql-general@postgresql.org <pgsql-general@postgresql.org>
Date: Monday, April 24, 2000 1:13 AM
Subject: [GENERAL] Revisited: Transactions, insert unique.


>Hi,
>
>Previously I wanted to ensure that I am inserting something unique into a
>table, the answer was to create a unique index on the relevant columns.
>
>But what if I don't want to get an error which would force a rollback? Say
>I want to insert something if it doesn't already exist, but update it if it
>does.
>
>Do I have to lock the whole table?
>
>Would it be a good idea to be able to request a lock on an arbitrary string
>like in MySQL? Then I could perhaps do something like
>
>LOCK HANDLE('max255charstring',TimeoutInSeconds)
>e.g.
>LOCK HANDLE('mytable,field1=x,field2=y',10)
>
>Then I could control access to a row that may not even exist, or do other
>snazzy transaction stuff.
>
>Cheerio,
>Link.
>


pgsql-general by date:

Previous
From: Ed Loehr
Date:
Subject: Re: Revisited: Transactions, insert unique.
Next
From: JohnC@firstlight.com
Date:
Subject: Referential Integrity Problems