Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

operator does not exist: text ->> unknown

Tags:

sql

postgresql

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.

like image 688
KlmNoRs29 Avatar asked Sep 04 '26 20:09

KlmNoRs29


1 Answers

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.


Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!