On 7/2/06, Michael Glaesemann <[EMAIL PROTECTED]> wrote:

On Jul 2, 2006, at 17:15 , Coda Hale wrote:

> Well, I'm working with MySQL, which returns records by order of
> primary key. (I think.) Does anyone know of any Rails-supported RDBMS
> which doesn't do this?

PostgreSQL follows the SQL-spec in this case.

On 7/2/06, Michael A. Schoen <[EMAIL PROTECTED]> wrote:
Oracle doesn't [order by primary key].

Grah.

Okay, that's compelling enough to ditch ordering by the primary key.

The unintended consequences of this is that if someone adds an
:include option with an ordered association in a find without an
:order option, the first-order results will appear in a different
order:

 Author.find(:all).map(&:id) != Author.find(:all, :include =>
[:posts]).map(&:id)

This is not particularly friendly behavior, but the buck for this can
be passed on to the SQL standard: if you want an order, specify an
order. Otherwise, don't expect anything.

Does this seem like a valid tradeoff to everyone?

--
Coda Hale
http://blog.codahale.com
_______________________________________________
Rails-core mailing list
Rails-core@lists.rubyonrails.org
http://lists.rubyonrails.org/mailman/listinfo/rails-core

Reply via email to