From: | Ralph van Etten <ralph(at)et10(dot)org> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: serialization errors when inserting new records |
Date: | 2005-01-24 10:59:42 |
Message-ID: | Pine.LNX.4.44.0501241153170.2282-100000@exp-toy.et10.loc |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Mon, 24 Jan 2005, William Yu wrote:
> If you absolutely need the display field to be unique and it has to be a
> sequence starting from 1 -- it's simplicity itself. Use the
> serialization errors to your advantage. If you try to insert a record
> and you get a dupe key violation, just increment your seq counter by 1
> and try again. Keep trying until you succeed. No need to lock the tables
> at all.
Just trial and error ?
I don't think its a very good solution. Then you have to figure out
exactly which error it is and which column caused the violation. (How ? By
parsing the error string ???)
And if the correct error was returned you retry the query... But how many
times ? Just once ? or a 1000 times ?
I'm sorry but I think this solution is just a Q&D hack.
From | Date | Subject | |
---|---|---|---|
Next Message | Postgres General | 2005-01-24 11:02:45 | disable trigger from transaction |
Previous Message | Stefan Sturm | 2005-01-24 10:32:12 | Savepoint Problem |