Re: JSON Function Bike Shedding

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Andres Freund <andres(at)2ndquadrant(dot)com>
Cc: "David E(dot) Wheeler" <david(at)justatheory(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: JSON Function Bike Shedding
Date: 2013-02-16 20:47:08
Message-ID: 511FF04C.7060709@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


On 02/16/2013 03:05 PM, Andres Freund wrote:
> On 2013-02-16 11:55:26 -0800, David E. Wheeler wrote:
>> On Feb 16, 2013, at 8:57 AM, Andrew Dunstan <andrew(at)dunslane(dot)net> wrote:
>>
>>> I have had a look at doing something like this with the json_get functions. The trouble is that the best way to do it is to have json_get take "variadic any", but then string literals come in as unknown rather than as text, which makes things fairly ugly. If we force people to cast path elements to text then I think the cure is worse than the disease. I think the best we can do here is possibly to provide json_get and json_get_text taking either a single int or variadic text[], and json_get_path and json_get_path_text taking non-variadic text[].
>> Why not also one taking a single text?
>>
>> get(text)
>> get(int)
>> get(variadic text[])
> Those aren't differentiable by their argument types. Why should json be
> able to claim that namespace and not other datatypes?
>

Well, of course the calls would be

get(json, ...)

although I'm still waiting to see if anyone else agrees with Robert
about the naming of the functions.

To answer David's point, there is no point in having both

get(json,text)
get(json, variadic text[])

since the second can encompass the first, and having both would make
calls ambiguous.

cheers

andrew

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2013-02-16 23:44:45 Re: FDW for PostgreSQL
Previous Message Andres Freund 2013-02-16 20:05:28 Re: JSON Function Bike Shedding