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




--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to