Re: Cast jsonb to numeric, int, float, bool

From: Jim Nasby <Jim(dot)Nasby(at)BlueTreble(dot)com>
To: Nikita Glukhov <n(dot)gluhov(at)postgrespro(dot)ru>, <a(dot)lubennikova(at)postgrespro(dot)ru>
Cc: PostgreSQL mailing lists <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Cast jsonb to numeric, int, float, bool
Date: 2017-02-01 22:07:50
Message-ID: 6e36f08b-0fa5-445e-55bc-654b9afb7f04@BlueTreble.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2/1/17 8:26 AM, Nikita Glukhov wrote:
>> If you find it useful, I can also add support of json and other types,
>> such as smallint and bigint.
>
> Yes, I'd like to have support for other types and maybe for json.

There's been previous discussion about something similar, which would be
better supporting "casting an unknown to smallint". IIRC there's some
non-trivial problem with trying to support that.

> Some comments about the code: I think it would be better to
> * add function for extraction of scalars from pseudo-arrays
> * iterate until WJB_DONE to pfree iterator

I'm not sure what your intent here is, but if the idea is that a json
array would magically cast to a bool or a number data type I think
that's a bad idea.
--
Jim Nasby, Data Architect, Blue Treble Consulting, Austin TX
Experts in Analytics, Data Architecture and PostgreSQL
Data in Trouble? Get it in Treble! http://BlueTreble.com
855-TREBLE2 (855-873-2532)

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2017-02-01 22:19:24 Re: Patch: Write Amplification Reduction Method (WARM)
Previous Message Jim Nasby 2017-02-01 22:01:43 Re: Time to up bgwriter_lru_maxpages?