pg.ddx.io  pgsql-docs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael Paquier <michael@paquier.xyz>
To: Oleg Bartunov <obartunov@postgrespro.ru>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-docs@lists.postgresql.org
Subject: Re: document json[b] limitation
Date: Thu, 26 Apr 2018 10:59:10 +0900
Message-ID: <20180426015910.GC18940@paquier.xyz> (raw)
In-Reply-To: <CAF4Au4zf7_39btnAbH1M0sWFc4i0NPPNGfV_EbRbjeCMpj305w@mail.gmail.com>
References: <CAF4Au4yV8k53_9YhhNLVhX_xQzmtAjcbvOWN4oFL3Nt2ayDzVA@mail.gmail.com>
	<17093.1524611576@sss.pgh.pa.us>
	<CAF4Au4zf7_39btnAbH1M0sWFc4i0NPPNGfV_EbRbjeCMpj305w@mail.gmail.com>

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

Attachments:

  signature.asc (application/pgp-signature, 832B) download

view thread (5+ messages)

Message-ID: <20180426015910.GC18940@paquier.xyz>
Permalink:  ../20180426015910.GC18940@paquier.xyz/
Also on:    postgresql.org/message-id/20180426015910.GC18940@paquier.xyz

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-docs@postgresql.org
  Cc: michael@paquier.xyz, obartunov@postgrespro.ru, tgl@sss.pgh.pa.us, pgsql-docs@lists.postgresql.org
  Subject: Re: document json[b] limitation
  In-Reply-To: <20180426015910.GC18940@paquier.xyz>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox