This project is archived and is in readonly mode.

#390 ✓ resolved
Olek Poplavsky

postgres adapter quotes table name, breaks when non-default schema is used

Reported by Olek Poplavsky | June 11th, 2008 @ 05:20 PM

Our app is using some tables in non-default schemas. It used to work ok, only thing to do was to set table name manually, like:

class PersistedProperty < ActiveRecord::Base
    set_table_name 'common.persisted_properties'
end

It broke with Rails 2.1 because AbscractAdapter now includes module abstract/quoting.rb, and that one defines quoting of table names by default. In postgres, quoting like this 'select * from "bar"' works, so is 'select * from foo."bar"', but 'select * from "foo.bar"' does NOT work.

I monkey patched this issue locally using included code, but it would be nice to have it fixed in the source. Included fix is just a quick workaround, it may be or may not be the code for longer term fix.

module ActiveRecord
  module ConnectionAdapters
    class PostgreSQLAdapter < AbstractAdapter
      def quote_table_name(name)
        name
      end
    end
  end
end

Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

Tickets have moved to Github

The new ticket tracker is available at https://github.com/rails/rails/issues

Shared Ticket Bins

Attachments

Referenced by

Pages