public inbox for [email protected]
help / color / mirror / Atom feedFrom: Andrew Dunstan <[email protected]>
To: Himanshu Upadhyaya <[email protected]>
Cc: Nikita Glukhov <[email protected]>
Cc: PostgreSQL-development <[email protected]>
Cc: Dmitry Dolgov <[email protected]>
Cc: Oleg Bartunov <[email protected]>
Cc: Erik Rijkers <[email protected]>
Subject: Re: SQL/JSON: functions
Date: Tue, 4 Jan 2022 08:53:13 -0500
Message-ID: <[email protected]> (raw)
In-Reply-To: <CAPF61jCW9=VTkpGRUQCMZ7AD+u0x2rMvt5xvcJh6LDbkxWL8kQ@mail.gmail.com>
References: <[email protected]>
<[email protected]>
<[email protected]>
<CALtqXTdHvT+tsGm4=aGL9=vFuiRX=dk0fHGtAjqCe=QSQmWKwA@mail.gmail.com>
<[email protected]>
<[email protected]>
<[email protected]>
<[email protected]>
<CAD5tBcL5pr673RUED4Diy4PV7yKpY1HX_rt0N_W1d9XtLoC7kA@mail.gmail.com>
<[email protected]>
<[email protected]>
<[email protected]>
<[email protected]>
<[email protected]>
<CAPF61jDv+qf4ZTm16quEQ5_DKXb0nSZ1OUTN7g2ELDssYLWrVQ@mail.gmail.com>
<[email protected]>
<CAPF61jCW9=VTkpGRUQCMZ7AD+u0x2rMvt5xvcJh6LDbkxWL8kQ@mail.gmail.com>
On 1/4/22 04:18, Himanshu Upadhyaya wrote:
> On Thu, Dec 16, 2021 at 3:06 AM Andrew Dunstan <[email protected]> wrote:
>>
>>
>> SELECT JSON_OBJECTAGG(k: v ABSENT ON NULL) AS apt
>> FROM (VALUES ('no', 5), ('area', 50), ('rooms', 2), ('foo', NULL),
>> (5,5)) kv(k, v);
>> ERROR: 22P02: invalid input syntax for type integer: "no"
>> LINE 2: FROM (VALUES ('no', 5), ('area', 50), ('rooms', 2), ('foo', ...
>> ^
>> LOCATION: pg_strtoint32, numutils.c:320
>>
>> Above call to JSON_OBJECTAGG is failing because we have the numeric
>> key, is not that it also needs to follow the same context of
>> converting key argument to text? or both(JSON_OBJECTAGG and
>> JSON_OBJECT) should not allow numeric keys in the JSON object and
>> allow date (if that is the only use case)?
>>
this error has nothing at all to do with the json code. You simply have
an invalid VALUES expression:
postgres=# select * FROM (VALUES ('no', 5), ('area', 50), ('rooms', 2),
('foo', NULL), (5,5)) kv(k, v);
ERROR: invalid input syntax for type integer: "no"
LINE 1: select * FROM (VALUES ('no', 5), ('area', 50), ('rooms', 2),...
cheers
andrew
--
Andrew Dunstan
EDB: https://www.enterprisedb.com
view thread (4+ messages)
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected], [email protected], [email protected], [email protected], [email protected]
Subject: Re: SQL/JSON: functions
In-Reply-To: <[email protected]>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox