我的值为jsonb
,其密钥包含int
。
我想将其插入带有int
列的表格中。我收到ERROR: column "abr" is of type integer but expression is of type text
LINE 4: values->>'abr' as abr,
select
values->>'_filename' as _filename,
values->>'abr' as abr
from temp_json;
如何使用abr
键作为int?
答案 0 :(得分:1)
这有效:
select
values->>'_filename' as _filename,
(values->>'abr')::int as abr
from temp_json;