Re: Cast jsonb to numeric, int, float, bool
Jim Nasby <jim.nasby@bluetreble.com>
From: Jim Nasby <Jim.Nasby@BlueTreble.com>
To: Nikita Glukhov <n.gluhov@postgrespro.ru>, <a.lubennikova@postgrespro.ru>
Cc: PostgreSQL mailing lists <pgsql-hackers@postgresql.org>
Date: 2017-02-01T22:07:50Z
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)
Commits
-
Add casts from jsonb
- c0cbe00fee6d 11.0 landed