1

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.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.