我使用ruby,pg和续集。我把数组写入db,但无法取回。 这是代码示例:
require "sequel"
require "pg"
Sequel.extension :pg_array, :core_extensions
DB = Sequel.connect("postgres://postgres@localhost/postgres")
DB.create_table? :items do
primary_key :id
column :positions, "integer[]"
end
items = DB[:items]
items.insert(positions: Sequel.pg_array([1, 2, 3]))
items.all.last[:positions] # <---- it is string. Not array
有人可以帮我吗?