Re: json_to_recordset not working with camelcase json keys

Поиск
Список
Период
Сортировка
От Joe Conway
Тема Re: json_to_recordset not working with camelcase json keys
Дата
Msg-id 56709F85.1040003@joeconway.com
обсуждение исходный текст
Ответ на json_to_recordset not working with camelcase json keys  (Daniel Kellenberger <Daniel.Kellenberger@netcetera.com>)
Ответы Re: json_to_recordset not working with camelcase json keys  (Daniel Kellenberger <Daniel.Kellenberger@netcetera.com>)
Список pgsql-bugs
On 12/15/2015 01:46 PM, Daniel Kellenberger wrote:
> We tried to extract from a json with camel case keys values, but
> unfortunatelly they are not mapped.
>=20
> Testcase: (PostgreSQL 9.4.5)
>=20
> select * from
> json_to_recordset('[{"aB":1,"bC":"foo"},{"aB":"2","cD":"bar"}]') as x(a=
B
> int, bC text);

Not a bug, I believe. You probably meant this:

select * from json_to_recordset('[{"aB":1,"bC":"foo"},
                                  {"aB":"2","cD":"bar"}]')
              as x("aB" int, "bC" text, "cD" text);
 aB | bC  | cD
----+-----+-----
  1 | foo |
  2 |     | bar
(2 rows)

Unquoted identifiers are lowercased in postgres, so for camel case
identifiers you would need double quotes.

HTH,

Joe

--=20
Crunchy Data - http://crunchydata.com
PostgreSQL Support for Secure Enterprises
Consulting, Training, & Open Source Development

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

Предыдущее
От: Daniel Kellenberger
Дата:
Сообщение: json_to_recordset not working with camelcase json keys
Следующее
От: Alvaro Herrera
Дата:
Сообщение: Re: BUG #13666: REASSIGN OWNED BY doesn't affect the relation underlying composite type