Re: new json funcs

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
Cc: Merlin Moncure <mmoncure(at)gmail(dot)com>, Josh Berkus <josh(at)agliodbs(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: new json funcs
Date: 2014-01-27 21:00:02
Message-ID: 52E6C8D2.2010601@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


On 01/27/2014 03:53 PM, Alvaro Herrera wrote:
> 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.
>

I'm not sure I understand the need. This is the difference between the
_text variants and their parents. Why would you call json_object_field
when you want the dequoted text?

cheers

andrew

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2014-01-27 21:06:50 Re: new json funcs
Previous Message Simon Riggs 2014-01-27 20:57:26 Re: ALTER TABLE lock strength reduction patch is unsafe