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.

asked Mar 17, 2019 at 20:57

0

Know someone who can answer? Share a link to this question via email, Twitter, or Facebook.

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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.