Re: JSON manipulation functions

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: JSON manipulation functions
Дата
Msg-id 20885.1273864195@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: JSON manipulation functions  (Robert Haas <robertmhaas@gmail.com>)
Ответы Re: JSON manipulation functions  (Pavel Stehule <pavel.stehule@gmail.com>)
Список pgsql-hackers
Robert Haas <robertmhaas@gmail.com> writes:
> On Thu, May 13, 2010 at 9:47 PM, Joseph Adams
> <joeyadams3.14159@gmail.com> wrote:
>> [] retrieves a value of a JSON array/object by (one-based) index. �In
>> other words, value[n] is equivalent to selecting the nth row of
>> json_values(value) (provided value is of type JSON). �Examples:
>> 
>> SELECT ('[1,2,3,4]'::JSON)[3]
>> -- Result is '3'::JSON
>> 
>> SELECT ('{"a": 1, "b": 2, "c": 3, "d": 4}'::JSON)[3]
>> -- Result is '3'::JSON

> I think some kind of array deference and object deference mechanism is
> absolutely, positively 100% required.  I don't know whether the
> particular syntax you've proposed here is best or whether we should
> pick another syntax or just use function notation, but I think we
> definitely need *something*.

Trying to use array notation on something that isn't a SQL array type
is guaranteed to be a mess.  I strongly recommend that you not attempt
that.  Just define a function for it.
        regards, tom lane


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Kenneth Marshall
Дата:
Сообщение: Re: Generating Lots of PKs with nextval(): A Feature Proposal
Следующее
От: "Marc G. Fournier"
Дата:
Сообщение: Re: List traffic