PG :: CannotCoerce:错误:无法将类型regproc转换为字符变化

时间:2015-07-16 07:09:31

标签: ruby-on-rails

源代码:

class GpRequest < ActiveRecord::Base
  establish_connection(
   :adapter=> "postgresql",
   :database=> "xxx",
   :username=> "xxx",
   :password=> "xxx",
   :host=> "xxx"
)
  def self.query
    sql = "SELECT * FROM  table;"
    result = self.connection.exec_query(sql)
  end
end

ENV:

ruby 2.2.1p85
pg (0.18.2)
activerecord (4.2.3)

但在exec GpRequest.query时出现了错误:

  

gems / activerecord4.2.3 / lib / active_record / connection_adapters / postgresql_adapter.rb:596:in`async_exec':PG :: CannotCoerce:ERROR:无法将类型regproc转换为字符变化(ActiveRecord :: StatementInvalid)

这就是为什么,任何人都可以帮助我?

0 个答案:

没有答案