当我在使用JSON列的表上查询时,我收到此错误。
PG :: InvalidParameterValue:错误:无法在标量上调用json_array_elements
表格结构
create_table :certificates, force: true do |t|
t.column :completions, :json
t.datetime :created_at, null: false
t.datetime :updated_at, null: false
end
查询
WITH completions AS (
SELECT *, json_array_elements(completions) AS completions_json
FROM certificates
)
SELECT * from completions;