Re: WIP Patch: Add a function that returns binary JSONB as a bytea

From: Andres Freund <andres(at)anarazel(dot)de>
To: Merlin Moncure <mmoncure(at)gmail(dot)com>
Cc: Andrew Dunstan <andrew(dot)dunstan(at)2ndquadrant(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Stephen Frost <sfrost(at)snowman(dot)net>, kevinvan(at)shift(dot)com, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: WIP Patch: Add a function that returns binary JSONB as a bytea
Date: 2018-11-02 21:15:41
Message-ID: 20181102211541.bmnvyyflv2ngfat3@alap3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2018-11-02 10:34:07 -0500, Merlin Moncure wrote:
> On Wed, Oct 31, 2018 at 10:23 AM Andres Freund <andres(at)anarazel(dot)de> wrote:
> >
> > Hi,
> >
> > On 2018-10-31 11:13:13 -0400, Andrew Dunstan wrote:
> > > I agree that just sending a blob of the internal format isn't a great idea.
> >
> > It's entirely unacceptable afaict. Besides the whole "exposing
> > internals" issue, it's also at least not endianess safe, depends on the
> > local alignment requirements (which differ both between platforms and
> > 32/64 bit), numeric's internal encoding and probably more.
>
> Binary format consuming applications already have to deal with these
> kinds of issues.

Uh, which? We have some that are affected by configure flags, but
otherwise we should be endianess & alignment independent.

And *even if* that were the case, that's not a good reason to continue a
bad practice.

> For jsonb we decided to implement a version flag within the type
> itself, which I thought mistake at the time -- better to have a
> version header in the COPY BINARY if needed.

What's the problem with the version? How does a COPY BINARY flag
address normal clients?

Greetings,

Andres Freund

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2018-11-02 21:18:16 Re: WIP Patch: Add a function that returns binary JSONB as a bytea
Previous Message Andrew Dunstan 2018-11-02 21:02:24 Re: WIP Patch: Add a function that returns binary JSONB as a bytea