Re: printing JsonbPair values of input JSONB on server side?

2019-03-19 Thread T L
re > there to provide that service. Another function to check out 'jsonb_each', > other than the set returning function parts, it does what it looks like > your are trying to do. > > -Michel > > On Mon, Mar 18, 2019 at 4:12 PM Andrew Gierth > wrote: > >> >

Re: printing JsonbPair values of input JSONB on server side?

2019-03-19 Thread T L
C (or > Python, since pdb shares many of gdb's keybindings). > > But just looking at the function I don't see what's immediately wrong, > what's your CREATE FUNCTION statement look like? > > On Tue, Mar 19, 2019 at 1:08 PM T L wrote: > >> Thanks a lot fo

Re: printing JsonbPair values of input JSONB on server side?

2019-03-19 Thread T L
chel Pelletier wrote: > jsonb_each is a wrapper around each_worker_jsonb. It produces a row for > every key/value pair in an object. > > > https://doxygen.postgresql.org/jsonfuncs_8c.html#a7511a3aa3918eb956f3f4211d07bdbb0 > > the iteration is: > > while ((r = JsonbI

Re: printing JsonbPair values of input JSONB on server side?

2019-03-19 Thread T L
Michel Pelletier wrote: > Yeah I'm not sure why you're looping using pointer math, the iterators are > there to provide that service. Another function to check out 'jsonb_each', > other than the set returning function parts, it does what it looks like > your are tryin

Re: printing JsonbPair values of input JSONB on server side?

2019-03-18 Thread T L
rint_kv_pair('{"a":1.0, "b": 2.0}'::jsonb); NOTICE: print_kv_pair(): ok0 NOTICE: print_kv_pair(): ok1 NOTICE: print_kv_pair(): ok2 NOTICE: print_kv_pair(): ok3, nPairs = 2 NOTICE: print_kv_pair(): k = �J ERROR: value must be numeric On Mon, Mar 18, 20

Re: printing JsonbPair values of input JSONB on server side?

2019-03-18 Thread T L
g } elog(NOTICE, "print_kv_pair(): ok4"); PG_RETURN_JSONB_P(JsonbValueToJsonb(object)); } On Mon, Mar 18, 2019 at 3:20 PM Andrew Gierth wrote: > >>>>> "T" == T L writes: > > T> //Problem line!!! > T> //el

printing JsonbPair values of input JSONB on server side?

2019-03-18 Thread T L
Hi, I am trying to write a PostgreSQL (11.2) server side function to read the key-value pairs of an input JSONB object. The code I have assembled so far (by mimicking existing code I can find) is below. (This is the closest thing I can find/write, and I couldn't find any documentation by the way.)