Permalink
Browse files

PostgreSQL: quote bare table names

  • Loading branch information...
1 parent 27b68e3 commit 87fa9db9e2a45318a775de35a66358e7bc61c3e5 @jeremy jeremy committed Jun 7, 2008
Showing with 3 additions and 3 deletions.
  1. +3 −3 activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
View
6 activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
@@ -506,15 +506,15 @@ def create_database(name, options = {})
end
end
- execute "CREATE DATABASE #{name}#{option_string}"
+ execute "CREATE DATABASE #{quote_table_name(name)}#{option_string}"
end
# Drops a PostgreSQL database
#
# Example:
# drop_database 'matt_development'
def drop_database(name) #:nodoc:
- execute "DROP DATABASE IF EXISTS #{name}"
+ execute "DROP DATABASE IF EXISTS #{quote_table_name(name)}"
end
@@ -676,7 +676,7 @@ def pk_and_sequence_for(table) #:nodoc:
# Renames a table.
def rename_table(name, new_name)
- execute "ALTER TABLE #{name} RENAME TO #{new_name}"
+ execute "ALTER TABLE #{quote_table_name(name)} RENAME TO #{quote_table_name(new_name)}"
end
# Adds a new column to the named table.

0 comments on commit 87fa9db

Please sign in to comment.