rails/rails — Issue #5152: postgresql_adapter+def distinct+nulls
Author: matrol26
Created: 2012-02-24 14:06:14+00:00
State: open

Def distinct doesn't delete "nulls first" or "nulls last" from order-items with includes, so that distinct select fails.

File: activerecord-3.2.1/lib/active_record/connection_adapters/postgresql_adapter.rb line 1059:
old:
```order_columns = orders.collect { |s| s.gsub(/\s+(ASC|DESC)\s*/i, '') }```
new:
```order_columns = orders.collect { |s| s.gsub(/\s+(ASC|DESC)\s*(NULLS\s+(FIRST|LAST)\s*)?/i, '') }```