I am trying to take info from my json field, which is created using c#, enter image description here
SELECT "Price"->>'TotalPrice' FROM "Table"
but I have error in postgres
ERROR: operator does not exist: text ->> unknown LINE 1: SELECT "Price"->>'Price' FROM "ReadModel"... No operator matches the given name and argument types. You might need to add explicit type casts.
The error message is pretty obvious: your column is defined as text not as jsonb or json. But the ->> operator only works with a jsonb or json column, so you will need to cast it:
SELECT "Price"::jsonb ->> 'TotalPrice'
FROM "ReadModel"."MyListingDto"
Unrelated to your problem, but: you should really avoid those dreaded quoted identifiers. They are much more trouble than they are worth it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With