Re: new json funcs - Mailing list pgsql-hackers

From Alvaro Herrera
Subject Re: new json funcs
Date
Msg-id 20140127205346.GL10723@eldon.alvh.no-ip.org
Whole thread Raw
In response to Re: new json funcs  (Andrew Dunstan <andrew@dunslane.net>)
Responses Re: new json funcs  (Andrew Dunstan <andrew@dunslane.net>)
List pgsql-hackers
Andrew Dunstan escribió:

> Note that we can only do this when the result type stays the same.
> It does not for json_each/json_each_text or
> json_extract_path/json_extract_path_text, which is why we have
> different functions for those cases.

In C code, if I extract a value using json_object_field or
json_array_element, is there a way to turn it into the dequoted version,
that is, the value that I would have gotten had I called
json_object_field_text or json_array_element_text instead?

I wrote a quick and dirty hack in the event triggers patch that just
removes the outermost "" and turns any \" into ", but that's probably
incomplete.  Does jsonfuncs.c offer any way to do this?  That might be
useful for the crowd that cares about the detail being discussed in this
subthread.

Thanks,

-- 
Álvaro Herrera                http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: ALTER TABLE lock strength reduction patch is unsafe
Next
From: Simon Riggs
Date:
Subject: Re: ALTER TABLE lock strength reduction patch is unsafe