Re: document json[b] limitation

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Oleg Bartunov <obartunov(at)postgrespro(dot)ru>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-docs(at)lists(dot)postgresql(dot)org
Subject: Re: document json[b] limitation
Date: 2018-04-26 01:59:10
Message-ID: 20180426015910.GC18940@paquier.xyz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-docs

On Wed, Apr 25, 2018 at 06:50:51PM +0300, Oleg Bartunov wrote:
> Oops, it should be 256 Mb :)

The numbers you are presenting are right, aka 1GB for json:
=# create table aa (a json);
CREATE TABLE
=# insert into aa select ('{"key":"' || repeat('a', 512 * 1024 * 1024) ||
repeat('a', 500 * 1024 * 1024) || '"}')::json;
INSERT 0 1
=# insert into aa select ('{"key":"' || repeat('a', 512 * 1024 *
1024) || repeat('a', 512 * 1024 * 1024) || '"}')::json;
ERROR: XX000: invalid memory alloc request size 1073741836
LOCATION: palloc, mcxt.c:934

And 256MB for jsonb:
=# create table ab (a jsonb);
CREATE TABLE
=# insert into aa select ('{"key":"' || repeat('a', 256 * 1024 *
1024) || '"}')::jsonb;
ERROR: 54000: string too long to represent as jsonb string
DETAIL: Due to an implementation restriction, jsonb strings cannot
exceed 268435455 bytes.

Be sure to use an upper-case "B" to mean bytes and not bits in the
documentation.
--
Michael

In response to

Browse pgsql-docs by date

  From Date Subject
Next Message Bruce Momjian 2018-04-26 15:11:37 Re: Pgadmin III is officially not supported
Previous Message Bruce Momjian 2018-04-25 22:55:44 Re: how does jsonb_set work?