Re: How to get the size of JSONB in bytes?

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Dmitry Savenko <ds(at)dsavenko(dot)com>
Cc: Jim Nasby <Jim(dot)Nasby(at)bluetreble(dot)com>, Petr Korobeinikov <pkorobeinikov(at)gmail(dot)com>, "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: How to get the size of JSONB in bytes?
Date: 2015-12-16 05:30:59
Message-ID: CAKFQuwZ=-iT-veDcWiYdv2v8LfyPDdtHC363U2s4+E+EBT++Rg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, Dec 15, 2015 at 9:54 PM, Dmitry Savenko <ds(at)dsavenko(dot)com> wrote:

>
> and now it works! I think they should add casting to 'bytea' directly,
> such workarounds shouldn't be necessary.
>

Casting to bytea and counting the bytes is just as hackey, IMO. If this
use-case wants to be officially supported the type itself should define
what "length/size" means and a function should be provided to extract that
value. I have the impression that the content length is already part of
the stored data so really only the function would be needed. I haven't
given it that much thought, and zero present research, so I may be
mis-remembering old threads.

​David J.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message zh1029 2015-12-16 06:26:40 Does PostgreSQL support to write glusterfs by Libgfapi
Previous Message Dmitry Savenko 2015-12-16 04:54:41 Re: How to get the size of JSONB in bytes?