Re: BUG #13485: JSONB To recordset not working with CamelCase

Поиск
Список
Период
Сортировка
От Roberto Morelli
Тема Re: BUG #13485: JSONB To recordset not working with CamelCase
Дата
Msg-id 19939E93-C49F-4AC2-8A60-CB6D6127322A@oneoverzero.net
обсуждение исходный текст
Ответ на Re: BUG #13485: JSONB To recordset not working with CamelCase  ("David G. Johnston" <david.g.johnston@gmail.com>)
Список pgsql-bugs
Hello David,

yes, it works, thank you!!!

CREATE TYPE nsp.TraitInfluence AS
(
    "traitId"     uuid,
    "direction"   nsp.direction_enum,
    "confidence"  nsp.confidence_enum
);

Best regards
Roberto

> On 03 Jul 2015, at 20:53, David G. Johnston =
<david.g.johnston@gmail.com> wrote:
>=20
> On Friday, July 3, 2015, <roberto.morelli@oneoverzero.net =
<mailto:roberto.morelli@oneoverzero.net>> wrote:
> The following bug has been logged on the website:
>=20
> Bug reference:      13485
> Logged by:          Roberto Morelli
> Email address:      roberto.morelli@oneoverzero.net <javascript:;>
> PostgreSQL version: 9.4.4
> Operating system:   MacOSX
> Description:
>=20
> Hello,
>=20
> I have encountered a problem with the jsonb type and the procedure
> jsonb_populate_recordset.
>=20
> If I have a type defined as:
>=20
> CREATE TYPE nsp.confidence_enum AS
> ENUM ('probably', 'conclusively', 'reliabily');
>=20
> CREATE TYPE nsp.direction_enum AS
> ENUM ('true', 'false');
>=20
> CREATE TYPE nsp.TraitInfluence AS
> (
>         traitId       uuid,
>         direction     nsp.direction_enum,
>         confidence    nsp.confidence_enum
> );
>=20
> Note the camel case in traitId of nsp.TraitInfluence. If I try to =
populate a
> recordset with the jsonb in the following way:
>=20
> select jsonb_populate_recordset(null::nsp.TraitInfluence, =
'[{"traitId":
> "c7fd7224-3f09-4a0a-941d-7a6a96d655b5", "direction": "true", =
"confidence":
> "probably"}]'::jsonb)
>=20
> I get the following result:
>=20
> "(,true,probably)"
>=20
> That is the traitId value is missing. I cannot change the camel case =
in the
> json payload because it is a third party data.
>=20
> How can I overcome this problem? The correct result should be:
>=20
> "(c7fd7224-3f09-4a0a-941d-7a6a96d655b5,true,probably)"
>=20
>=20
> Double-quote the field name in the create type statement.
>=20
> David J.=20

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

Предыдущее
От: Fabien COELHO
Дата:
Сообщение: Re: BUG #12379: pgbench should hint to pgbench -i
Следующее
От: Bailu Ding
Дата:
Сообщение: Re: BUG #13481: No config folder upon installation