On 12/21/07, Jeremy Kemper <[EMAIL PROTECTED]> wrote:
>
> On 12/21/07, pipa <[EMAIL PROTECTED]> wrote:
> > As far as I can judge locking FOR UPDATE can effectively save us from
> > the burden of parse-db-error-messages-and-retry approach, provided
> > that unique index is set on the corresponding column of course.
> > I dream I could do like this:
> > validates_uniqueness_of :something, :lock => true
> > and this would use the statements like the following:
> > SELECT .... WHERE something = ? FOR UPDATE
> > INSERT ....
> > This is not equal to table-level locking as in our case (uniqueness
> > checking) only access to a certain index gap is serialized and neither
> > other gaps nor existing rows are locked.
>
> That's cool. I thought FOR UPDATE wouldn't prevent inserts.

It doesn't.  It locks all the rows it selects, but since there's no
row yet, there's nothing to lock.

Assaf

> Is this
> also true for the other databases we support?
>
> jeremy
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Core" group.
To post to this group, send email to rubyonrails-core@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-core?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to