How can I read a json/jsonb field in a PostgreSQL server side function?
I am trying to write a server side function using C and SPI for PostgreSQL 11. The json field in mind is simple and contain only unnested key (text
) and value (float8
) pairs. I'd like to read these key value pairs into my C code and process it.
But after much searching on Google and here at DB.SE, I can't find any documentation on this. The results I got are for using json/jsonb on the client side, e.g.:
Pushing or appending to JSON array in PostgreSQL 9.4
https://stackoverflow.com/questions/32458524
I see there is PG_GETARG_JSONB
, e.g. here. But it is buried beneath other things and seems to require an external library.
Any pointers are appreciated.