Re: jsonb_array_length: ERROR: 22023: cannot get array length of a scalar - Mailing list pgsql-general

From David G. Johnston
Subject Re: jsonb_array_length: ERROR: 22023: cannot get array length of a scalar
Date
Msg-id CAKFQuwb2b7y3OrPCWxOqEm4u4my4VkvXUx3reNo7OuP==7ELHA@mail.gmail.com
Whole thread Raw
In response to Re: jsonb_array_length: ERROR: 22023: cannot get array length of ascalar  (Adrian Klaver <adrian.klaver@aklaver.com>)
Responses Re: jsonb_array_length: ERROR: 22023: cannot get array length of ascalar
List pgsql-general
On Friday, March 2, 2018, Adrian Klaver <adrian.klaver@aklaver.com> wrote:
On 03/02/2018 06:42 AM, Alexander Farber wrote:


2018-03-02 15:30:33.646 CET [16693] LOG:  duration: 0.058 ms  bind <unnamed>: SELECT out_uid  AS uid,  out_fcm  AS fcm,  out_apns AS apns, out_adm  AS adm,  out_body AS body  FROM words_play_game($1::int, $2::int, $3::jsonb)

where is $3::jsonb coming from?


Java prepared statement I think, using setString.

Not at computer right now but what does:

'[1,2,3]'::text::jsonb result in compared to '[1,2,3]'::jsonb ?

Because the system think your array-looking string is actually just a scalar that happens to have a leading [ and a trailing ] 

David J.

pgsql-general by date:

Previous
From: Adrian Klaver
Date:
Subject: Re: How can I include sql file in pgTAP unittest?
Next
From: Adrian Klaver
Date:
Subject: Re: jsonb_array_length: ERROR: 22023: cannot get array length of ascalar