diff options
Diffstat (limited to 'activerecord/lib/active_record/connection_adapters/abstract/quoting.rb')
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/abstract/quoting.rb | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/abstract/quoting.rb b/activerecord/lib/active_record/connection_adapters/abstract/quoting.rb index 99e1a11f30..a1b91c22de 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract/quoting.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract/quoting.rb @@ -155,7 +155,14 @@ module ActiveRecord # # "#{table_name}.#{column_name}" # "#{column_name}" - COLUMN_NAME = /\A(?:\w+\.)?\w+\z/i + COLUMN_NAME = / + \A + ( + (?:\w+\.)?\w+ + ) + (?:\s*,\s*\g<1>)* + \z + /ix # Regexp for column names with order (with or without a table name prefix, # with or without various order modifiers). Matches the following: @@ -170,10 +177,12 @@ module ActiveRecord # "#{column_name} NULLS LAST" COLUMN_NAME_WITH_ORDER = / \A - (?:\w+\.)? - \w+ - (?:\s+ASC|\s+DESC)? - (?:\s+NULLS\s+(?:FIRST|LAST))? + ( + (?:\w+\.)?\w+ + (?:\s+ASC|\s+DESC)? + (?:\s+NULLS\s+(?:FIRST|LAST))? + ) + (?:\s*,\s*\g<1>)* \z /ix |