Re: [SQL] Race condition in resetting a sequence

2007-08-10 Thread Scott Marlowe
On 8/4/07, Lew [EMAIL PROTECTED] wrote: Steve Midgley writes: The code I provided to reset a primary key sequence is actually part of Ruby on Rails core library - actually they use something very similar to what I originally sent: ... SELECT setval('#{sequence}', (SELECT

Re: [SQL] Race condition in resetting a sequence

2007-08-09 Thread Lew
Steve Midgley writes: The code I provided to reset a primary key sequence is actually part of Ruby on Rails core library - actually they use something very similar to what I originally sent: ... SELECT setval('#{sequence}', (SELECT COALESCE(MAX(#{pk})+(SELECT increment_by FROM #{sequence}),

[SQL] Race condition in resetting a sequence

2007-08-03 Thread Steve Midgley
Hi Scott, You've moved into more general territory, so I'm starting a new thread. The code I provided to reset a primary key sequence is actually part of Ruby on Rails core library - actually they use something very similar to what I originally sent: SELECT setval('#{sequence}', (SELECT

Re: [SQL] Race condition in resetting a sequence

2007-08-03 Thread Tom Lane
Steve Midgley [EMAIL PROTECTED] writes: The code I provided to reset a primary key sequence is actually part of Ruby on Rails core library - actually they use something very similar to what I originally sent: SELECT setval('#{sequence}', (SELECT COALESCE(MAX(#{pk})+(SELECT increment_by