Re: JSON Function Bike Shedding

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: "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 16:57:37
Message-ID: 511FBA81.8000403@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


On 02/13/2013 11:36 AM, Andrew Dunstan wrote:
>
>> Therefore, I would like to propose different names:
>>
>> Existing Name Proposed Name
>> -------------------------- ----------------------------------------
>> json_array_length() array_length() or length() or size()
>> json_each() each_json()
>> json_each_as_text() each_text()
>> json_get() get_json()
>> json_get_as_text() get_text()
>> json_get_path() get_json()
>> json_get_path_as_text() get_text()
>> json_object_keys() get_keys()
>> json_populate_record() record() or row()
>> json_populate_recordset() records() or rows()
>> json_unnest() get_values()
>> json_agg() collect_json()
>>
>> Note that I have given json_get() and json_get_path() the same names,
>> as it seems to me that the former is the same as the latter, with
>> only one parameter. Same for json_get_as_text() and
>> json_get_path_as_text().
>
> I will take some of this under advisement. Note that
> json_populate_record's name was taken from hstore's populate_record,
> so if we're trying to use similar names then it should possibly be
> just populate_record. Or if that's still a bit long I would accept
> to_record.

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[].

cheers

andrew

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2013-02-16 17:22:10 Re: [RFC] indirect toast tuple support
Previous Message Andres Freund 2013-02-16 16:42:31 [RFC] indirect toast tuple support