Re: WIP json generation enhancements

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: WIP json generation enhancements
Date: 2012-11-30 16:57:07
Message-ID: 50B8E563.6000708@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


On 11/27/2012 02:38 PM, Andrew Dunstan wrote:
>
> On 11/26/2012 12:31 PM, Robert Haas wrote:
>> On Mon, Nov 26, 2012 at 11:43 AM, Andrew Dunstan
>> <andrew(at)dunslane(dot)net> wrote:
>>> I don't understand why you would want to create such a cast. If the
>>> cast
>>> doesn't exist it will do exactly what it does now, i.e. use the type's
>>> output function and then json quote and escape it, which in the case of
>>> citext is the Right Thing (tm):
>>>
>>> andrew=# select to_json('foo"bar'::citext);
>>> to_json
>>> ------------
>>> "foo\"bar"
>> I'm not sure either, but setting up a system where seemingly innocuous
>> actions can in fact have surprising and not-easily-fixable
>> consequences in other parts of the system doesn't seem like good
>> design to me. Of course, maybe I'm misunderstanding what will happen;
>> I haven't actually tested it myself.
>>
>
>
> I'm all for caution, but the argument here seems a bit nebulous. We
> could create a sort of auxiliary type, as has been previously
> suggested, that would be in all respects the same as the json type
> except that it would be the target of the casts that would be used in
> to_json() and friends. But, that's a darned ugly thing to have to do,
> so I'd want a good concrete reason for doing it. Right now I'm having
> a hard time envisioning a problem that could be caused by just using
> the straightforward solution that's in my latest patch.
>
>

So, are there any other opinions on this besides mine and Robert's? I'd
like to move forward but I want to get this resolved first.

cheers

andrew

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2012-11-30 17:53:27 Re: Re: missing LockBuffer(buffer, BUFFER_LOCK_SHARE) in trigger.c GetTupleForTrigger?
Previous Message Tatsuo Ishii 2012-11-30 16:55:39 Re: [PATCH] Patch to fix a crash of psql