Fix for Postgres SQL generation error #1287
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This fixes an issue reported in Gitter where the generated SQL isn't compatible with Postgres.
ERROR: for SELECT DISTINCT, ORDER BY expressions must appear in select list
This fix tracks the fields used for sorting and ensures they are in the SQL used to pluck the results. The sort fields are tracking in an option and can therefore be set in a sort's apply callable. The join_manager was also moved into the options in order to allow correct tracking of joins.
I still need to update the documentation for this. I'll try to update this PR with some examples soon.
Most of the code changes are related to the tests and getting Travis testing with postgres. As of now you need to manually create the database (rake won't work) and set the
DATABASE_URL
environment variable to test locally against postgres. For example:Eventually I'll see if I can load the default rails rake tasks so a
db:create
can work, but that will be another PR.All Submissions:
New Feature Submissions:
Bug fixes and Changes to Core Features:
Test Plan:
Reviewer Checklist: