On 1 December 2010 21:37, Marnen Laibow-Koser <[email protected]> wrote: > Colin Law wrote in post #965538: >> On 1 December 2010 20:15, Marnen Laibow-Koser <[email protected]> >> wrote: >>> in the correct order, then your sorting is correct. >> Probably. I may be wrong but I believe that postgreSQL does not even >> guarantee that an unordered query will produce the same results if the >> same query is run twice. > > Right, SQL databases cannot be assumed to guarantee this. That's why I > suggested creating the factories in an arbitrary order, different from > what you want to see.
I don't think I made my point clearly. I believe that, in theory, even by creating the objects in an arbitrary order one cannot guarantee that an un-ordered query will not coincidentally end up with an ordered set. I do also believe however that the probability of this is so small as to considered negligible. It is still an interesting academic point if not an issue in practice. > >> Conceivably therefore I could test without >> the order clause and check it fails, then, thinking I had added the >> order clause re-run the test and find it pass. I think though as I >> said in an earlier post that I can use common sense and assume the >> probability of this is so small as to be insignificant. > > Well, if you create the factories in order, then there's a significant > probability of this happening... Certainly. Colin -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

