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