Re: [HACKERS] Cast jsonb to numeric, int, float, bool - Mailing list pgsql-hackers

From Jim Nasby
Subject Re: [HACKERS] Cast jsonb to numeric, int, float, bool
Date
Msg-id 6e36f08b-0fa5-445e-55bc-654b9afb7f04@BlueTreble.com
Whole thread Raw
In response to Re: [HACKERS] Cast jsonb to numeric, int, float, bool  (Nikita Glukhov <n.gluhov@postgrespro.ru>)
Responses Re: [HACKERS] Cast jsonb to numeric, int, float, bool  (Nikita Glukhov <n.gluhov@postgrespro.ru>)
List 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)



pgsql-hackers by date:

Previous
From: Jim Nasby
Date:
Subject: Re: [HACKERS] Time to up bgwriter_lru_maxpages?
Next
From: Tom Lane
Date:
Subject: Re: [HACKERS] Patch: Write Amplification Reduction Method (WARM)