Sample Header Ad - 728x90

How to read jsonb or json in postgresql spi?

1 vote
0 answers
132 views
*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.: https://dba.stackexchange.com/questions/102906 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.
Asked by tinlyx (3820 rep)
Mar 17, 2019, 08:57 PM