diff options
-rw-r--r-- | lib/arel/engines/sql/formatters.rb | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/arel/engines/sql/formatters.rb b/lib/arel/engines/sql/formatters.rb index 22935ebff1..626803a887 100644 --- a/lib/arel/engines/sql/formatters.rb +++ b/lib/arel/engines/sql/formatters.rb @@ -91,8 +91,12 @@ module Arel end def table(table) - quote_table_name(table.name) + - (table.name != name_for(table) ? " AS " + quote_table_name(name_for(table)) : '') + if table.name =~ /\s/ + table.name + else + quote_table_name(table.name) + + (table.name != name_for(table) ? " AS " + quote_table_name(name_for(table)) : '') + end end end |