Re: jsonb_array_elements issue

From: Mephysto <mephystoonhell(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>, "pgsql-bugs(at)postgresql(dot)org" <pgsql-bugs(at)postgresql(dot)org>, "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
Subject: Re: jsonb_array_elements issue
Date: 2016-08-16 16:26:18
Message-ID: CAG0sfBXGd3CZj9-OnyuEtG-kqS_XBvOFZ1U8CkZT71GpoCvoog@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Thank you very much for your explanation Tom.

Very kind regards.

Meph

On 16 Aug 2016 5:56 p.m., "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:

> Mephysto <mephystoonhell(at)gmail(dot)com> writes:
> > In my previous email I forgot to say that I create a cast in my database
> as
> > I made with JSON. The cast is this:
>
> > CREATE CAST (text AS JSONB) WITHOUT FUNCTION AS IMPLICIT;
>
> Well, that's rather a critical bit of information :-(
>
> > If you create this cast and you launch my select without the explicit
> cast,
> > you should get the error. With this cast created I reported some other
> > issues, so at this point my question is: can I use this implicit cast or
> is
> > better to explicit it anytime is needed?
>
> This cast definition is completely broken; it's astonishing that you
> haven't had outright crashes, because text and jsonb do NOT have the
> same underlying representation, which is what would be required to
> make a cast WITHOUT FUNCTION work correctly. But this certainly
> explains 'unknown type of jsonb container' errors.
>
> You could fix that by providing a suitable casting function. I'm still
> dubious that making it an implicit cast is a good idea though. The
> trouble with implicit casts is that they tend to kick in when you were
> not expecting them to. Past experience has suggested a rule of thumb
> that implicit cross-type-category casts are best avoided, and I'd
> certainly call this a type category crossing.
>
> regards, tom lane
>

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Andres Freund 2016-08-16 19:54:22 Re: BUG #14243: pg_basebackup failes by a STATUS_DELETE_PENDING file
Previous Message Tom Lane 2016-08-16 15:56:22 Re: jsonb_array_elements issue