Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Default ordering #57

Open
rhys-vdw opened this issue May 22, 2016 · 0 comments
Open

Default ordering #57

rhys-vdw opened this issue May 22, 2016 · 0 comments

Comments

@rhys-vdw
Copy link
Owner

Default ordering

SELECT statements without an ORDER BY clause are returned in an undefined order. This means any call with a LIMIT clause will return an unpredictable set of records. The obvious default order is the to sort by primary key ascending.

Current first will apply a default ordering, but not limit(20).fetch(), which is inconsistent.

Composite keys

It's unclear what the default ordering for a composite key table. Currently they are ordered by keys as specified.

Mapper.table('table').idAttribute('a', 'b').fetch()
// select * from table order by a asc, b asc
Disabling

To disable default ordering there might be a helper method Mapper#any or Mapper#unordered (if there is indeed any case in which this is useful...)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant