Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eTIbi-00017V-J5 for pgsql-bugs@arkaria.postgresql.org; Mon, 25 Dec 2017 02:35:14 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eTIbh-0001Ez-OX for pgsql-bugs@arkaria.postgresql.org; Mon, 25 Dec 2017 02:35:13 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1eTIbh-0001E7-JF for pgsql-bugs@lists.postgresql.org; Mon, 25 Dec 2017 02:35:13 +0000 Received: from [120.132.35.202] (helo=exchange44.qunarservers.com) by magus.postgresql.org with esmtps (TLS1.0:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1eTIbV-0005oI-Oe for pgsql-bugs@lists.postgresql.org; Mon, 25 Dec 2017 02:35:11 +0000 Received: from [10.86.14.156] (10.86.14.156) by exchange44.qunarservers.com (10.90.4.18) with Microsoft SMTP Server (TLS) id 14.3.224.2; Mon, 25 Dec 2017 10:34:48 +0800 Subject: Re: May be a jsonb type bug To: References: <129801513947874@web13g.yandex.ru> From: yunlong.gao Message-ID: Date: Mon, 25 Dec 2017 10:34:48 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0 MIME-Version: 1.0 In-Reply-To: <129801513947874@web13g.yandex.ru> Content-Type: multipart/alternative; boundary="------------5F857083F16BFABA5FC758DE" Content-Language: en-US X-Originating-IP: [10.86.14.156] X-Host-Lookup-Failed: Reverse DNS lookup failed for 120.132.35.202 (failed) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --------------5F857083F16BFABA5FC758DE Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 8bit Thank you very much 在 2017年12月22日 21:04, Sergei Kornilov 写道: > Hi > 'null' - is valid JSON document, but not array or object. It is just JSON-null in JSON. (not NULL in terms RDBMS) > Same as '"test"' - is valid JSON-encoded string 'test', '10' - valid JSON int scalar. > > jsonb_array_length accept only JSON array documents: '[1,2,3]', '[null, null]', '[]', '[{"n":1}]' and so on and not accept scalars and objects > > Regards, Sergej -- *PostgreSQL DBA yunlong.gao * pg开发指南 http://wiki.corp.qunar.com/pages/viewpage.action?pageId=58058230 pg发布流程 http://wiki.corp.qunar.com/pages/viewpage.action?pageId=56215301 pg值班列表 http://wiki.corp.qunar.com/pages/viewpage.action?pageId=50508626 pg机器列表 http://wiki.corp.qunar.com/pages/viewpage.action?pageId=36438672 pgbouncer http://wiki.corp.qunar.com/display/searchdev/pgbouncer+server --------------5F857083F16BFABA5FC758DE Content-Type: text/html; charset="utf-8" Content-Transfer-Encoding: 8bit

Thank you very much


在 2017年12月22日 21:04, Sergei Kornilov 写道:
Hi
'null' - is valid JSON document, but not array or object. It is just JSON-null in JSON. (not NULL in terms RDBMS)
Same as '"test"' - is valid JSON-encoded string 'test', '10' - valid JSON int scalar.

jsonb_array_length accept only JSON array documents: '[1,2,3]', '[null, null]', '[]', '[{"n":1}]' and so on and not accept scalars and objects

Regards, Sergej

--------------5F857083F16BFABA5FC758DE--