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@dunslane.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