From: | Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> |
---|---|
To: | Robert Haas <robertmhaas(at)gmail(dot)com> |
Cc: | Peter Krauss <ppkrauss(at)gmail(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Proposal for JSONB functions for internal representation casting insted text-casting |
Date: | 2016-01-06 19:05:01 |
Message-ID: | CAFj8pRDO26wyaUwyB6epFjKAfy44zgUr4Lkpyy-Y=8fjULuFhA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
2016-01-06 19:52 GMT+01:00 Robert Haas <robertmhaas(at)gmail(dot)com>:
> On Sun, Jan 3, 2016 at 3:24 PM, Peter Krauss <ppkrauss(at)gmail(dot)com> wrote:
> > The usefulness of ->> operator is indisputable, but even with boolean
> or
> > numeric values, with good binary internal representation, it returns
> JSONB
> > value as text data type.
> >
> > The simple (myJSONB->>'myField')::expectedType is not enough because:
> >
> > 1) there are no internal optimization, need two-step casting, first
> > bynary-to-text, them text-to-expectedType.
> >
> > 2) if expectedType is not the expected (in the associated jsonb_typeof),
> > generates an error... The ideal "return NULL" convention is not easy to
> > implement with usual casting.
>
@2 looks little bit dangerous. If expected number isn't number, but a
text, then I'll expect a exception in all cases.
Pavel
>
> Agreed, something like this would be useful.
>
>
> --
> Robert Haas
> EnterpriseDB: http://www.enterprisedb.com
> The Enterprise PostgreSQL Company
>
>
> --
> Sent via pgsql-hackers mailing list (pgsql-hackers(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-hackers
>
From | Date | Subject | |
---|---|---|---|
Next Message | Tomas Vondra | 2016-01-06 20:01:47 | Re: checkpointer continuous flushing |
Previous Message | Robert Haas | 2016-01-06 18:57:34 | Re: Better detail logging for password auth failures |