diff options
author | Godfrey Chan <godfreykfc@gmail.com> | 2014-08-23 23:54:22 -0700 |
---|---|---|
committer | Godfrey Chan <godfreykfc@gmail.com> | 2014-08-23 23:54:22 -0700 |
commit | 4287f6d456518652bb1a2035c9ecf96f1be28f79 (patch) | |
tree | 7f56a882952423574d33d36a947bc046e6c31a3c /activerecord/lib | |
parent | 5b27d15ff87b4a057edae942f8173f5ceb4a9196 (diff) | |
download | rails-4287f6d456518652bb1a2035c9ecf96f1be28f79.tar.gz rails-4287f6d456518652bb1a2035c9ecf96f1be28f79.tar.bz2 rails-4287f6d456518652bb1a2035c9ecf96f1be28f79.zip |
CHANGELOG & improvements to #16649
* Require either FIRST or LAST qualifier for "NULLS ..."
* Require whitespace before "NULLS ..."
Diffstat (limited to 'activerecord/lib')
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/postgresql/schema_statements.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/postgresql/schema_statements.rb b/activerecord/lib/active_record/connection_adapters/postgresql/schema_statements.rb index 6d5270cfc6..323da7b717 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql/schema_statements.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql/schema_statements.rb @@ -549,8 +549,8 @@ module ActiveRecord # 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(', ') |