List Info

Thread: Re: ar validations cannot work unless transaction isolation level is serialzable




Re: ar validations cannot work unless transaction isolation level is serialzable
user name
2007-12-21 19:29:38
On 12/21/07, Jeremy Kemper <jeremybitsweat.net> wrote:
>
> On 12/21/07, pipa <tekmongmail.com> 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-coregooglegroups.com
To unsubscribe from this group, send email to
rubyonrails-core-unsubscribegooglegroups.com
For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en
-~----------~----~----~----~------~----~------~--~---


[1]

about | contact  Other archives ( Real Estate discussion Medical topics )