CHANGELOG & improvements to #16649
* Require either FIRST or LAST qualifier for "NULLS ..." * Require whitespace before "NULLS ..."
This commit is contained in:
parent
5b27d15ff8
commit
4287f6d456
@ -1,3 +1,10 @@
|
||||
* Fixed a regression where whitespaces were stripped from DISTINCT queries in
|
||||
PostgreSQL.
|
||||
|
||||
*Agis Anastasopoulos*
|
||||
|
||||
Fixes #16623.
|
||||
|
||||
* Fix has_many :through relation merging failing when dynamic conditions are
|
||||
passed as a lambda with an arity of one.
|
||||
|
||||
|
@ -549,8 +549,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(', ')
|
||||
|
Loading…
Reference in New Issue
Block a user