Skip to content

Commit

Permalink
CHANGELOG & improvements to #16649
Browse files Browse the repository at this point in the history
* Require either FIRST or LAST qualifier for "NULLS ..."
* Require whitespace before "NULLS ..."

Conflicts:
	activerecord/CHANGELOG.md
  • Loading branch information
chancancode committed Aug 24, 2014
1 parent 8531663 commit ef7656c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
7 changes: 7 additions & 0 deletions activerecord/CHANGELOG.md
@@ -1,3 +1,10 @@
* Fixed a regression where whitespaces were stripped from DISTINCT queries in
PostgreSQL.

*Agis Anastasopoulos*

Fixes #16623.

* Fix regression on after_commit that didnt fire when having nested transactions.

Fixes #16425
Expand Down
Expand Up @@ -493,8 +493,8 @@ def columns_for_distinct(columns, orders) #:nodoc:
# Convert Arel node to string
s = s.to_sql unless s.is_a?(String)
# Remove any ASC/DESC modifiers
s.gsub(/\s+(?:ASC|DESC)\s*/i, '')
.gsub(/\s*NULLS\s+(?:FIRST|LAST)?\s*/i, '')
s.gsub(/\s+(?:ASC|DESC)\b/i, '')
.gsub(/\s+NULLS\s+(?:FIRST|LAST)\b/i, '')
}.reject(&:blank?).map.with_index { |column, i| "#{column} AS alias_#{i}" }

[super, *order_columns].join(', ')
Expand Down

0 comments on commit ef7656c

Please sign in to comment.