psql --version
psql (PostgreSQL) 9.4.1
rails -v
Rails 4.2.0我通过这样的迁移添加了一个jsonb列
class AddPreferencesToUsers < ActiveRecord::Migration
def change
add_column :users, :preferences, :jsonb, null: false, default: '{}'
add_index :users, :preferences, using: :gin
end
end我得到了这个错误:
PG::UndefinedObject: ERROR: type "jsonb" does not exist
LINE 1: SELECT 'jsonb'::regtype::oid有什么帮助吗?
发布于 2015-04-03 06:00:25
环顾四周后,通过运行正确的命令,我发现我的postgresql版本不是9.4
postgres=# SHOW SERVER_VERSION;
server_version
----------------
9.1所以我不得不简单地将我的postgresql升级到9.4。
顺便说一句,我跟随this article进行了升级,我发现这非常方便。
现在:
postgres=# SHOW SERVER_VERSION;
server_version
----------------
9.4.1希望这对有同样情况的人有所帮助。
https://stackoverflow.com/questions/29393562
复制相似问题