This one time, at band camp, Michael Kraus wrote:
>
>No, this definetly opens up race conditions and lots of rollbacks and
>reprocessing.
>
>Eg (in pseudocode).
>
>id = execute("SELECT MAX(id) FROM tablename") + 1;
>...
>result = execute("INSERT INTO tablename VALUE(id, ....)");
>if (!result) { rollback(); repeat(); }

Your +1 is broken.

id = select nextval(sequence);
insert into tablename (id, ...) values ($id, ...)

-- 
[EMAIL PROTECTED]                           http://spacepants.org/jaq.gpg
-- 
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html

Reply via email to