0

I've a value of jsonb which has a key that contains an int.

I'd like to insert this into a table with an int column. I get an error of 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;

How can I select the value with a key of abr as an int?

0

1 Answer 1

2

This works:

select
  values->>'_filename' as _filename,
  (values->>'abr')::int as abr
from   temp_json;
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.