Re: jsonb_array_length: ERROR: 22023: cannot get array length of a scalar

From: Alexander Farber <alexander(dot)farber(at)gmail(dot)com>
To:
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: jsonb_array_length: ERROR: 22023: cannot get array length of a scalar
Date: 2018-03-02 18:37:54
Message-ID: CAADeyWiKK7OX2JrLvBDm1WxEZJgGUmQt-bgwnJjqGcvcu3t=HA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Good evening -

On Fri, Mar 2, 2018 at 7:11 PM, Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
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?
>>
>>
>> I was thinking more about the ultimate source of the data. The
> words_play_game() function, AFAICT, just passes the jsonb from input into
> the word_moves table. If that is the case the problem may occur further
> upstream where the jsonb array is actually built.
>
>
that argument comes over Websocket - either from my Android app,
or from my HTML5 game at https://slova.de/words/Words.js (just an array of
objects, stringified):

var tiles = [];
for (var i = boardTiles.length - 1;
i >= 0; i--) {
var tile = boardTiles[i];
tiles.push({
letter: tile.letter,
value: tile.value,
col: tile.col,
row: tile.row
});
}

var play = {
social: SOCIAL,
sid: SID,
auth: AUTH,
action: 'play',
gid: gid,
tiles: tiles
};
ws.send(JSON.stringify(play));

Regards
Alex

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Alexander Farber 2018-03-02 18:43:12 Re: jsonb_array_length: ERROR: 22023: cannot get array length of a scalar
Previous Message Adrian Klaver 2018-03-02 18:11:06 Re: jsonb_array_length: ERROR: 22023: cannot get array length of a scalar