Craig James <craig_james(at)emolecules(dot)com> writes:> select objectid from archive where db_id is null limit 1 for update
The interaction between LIMIT and FOR UPDATE changed in 9.0 ... whatPG version are you using?
regards, tom lane