Re: Cast jsonb to numeric, int, float, bool
От
Darafei Komяpa Praliaskouski
Тема
Re: Cast jsonb to numeric, int, float, bool
Дата
Msg-id
CAC8Q8t++bOLPHqb1ui5Gg+w0vuhEoAg7B__1XpgT8xzi4MF2sA@mail.gmail.com
Ответ на
Re: Cast jsonb to numeric, int, float, bool (Tom Lane)
Список
Дерево обсуждения
[HACKERS] Cast jsonb to numeric, int, float, bool Anastasia Lubennikova <a.lubennikova@postgrespro.ru>
Re: [HACKERS] Cast jsonb to numeric, int, float, bool Nikita Glukhov <n.gluhov@postgrespro.ru>
Re: [HACKERS] Cast jsonb to numeric, int, float, bool Jim Nasby <Jim.Nasby@BlueTreble.com>
Re: [HACKERS] Cast jsonb to numeric, int, float, bool Nikita Glukhov <n.gluhov@postgrespro.ru>
Re: [HACKERS] Cast jsonb to numeric, int, float, bool Anastasia Lubennikova <a.lubennikova@postgrespro.ru>
Re: Cast jsonb to numeric, int, float, bool Darafei Praliaskouski <me@komzpa.net>
Re: Cast jsonb to numeric, int, float, bool Nikita Glukhov <n.gluhov@postgrespro.ru>
Re: Cast jsonb to numeric, int, float, bool Darafei "Komяpa" Praliaskouski <me@komzpa.net>
Re: Cast jsonb to numeric, int, float, bool Nikita Glukhov <n.gluhov@postgrespro.ru>
Re: Cast jsonb to numeric, int, float, bool Tom Lane <tgl@sss.pgh.pa.us>
Re: Cast jsonb to numeric, int, float, bool Darafei "Komяpa" Praliaskouski <me@komzpa.net>
Re: Cast jsonb to numeric, int, float, bool Tom Lane <tgl@sss.pgh.pa.us>
Re: Cast jsonb to numeric, int, float, bool Michael Paquier <michael@paquier.xyz>
Re: Cast jsonb to numeric, int, float, bool Darafei "Komяpa" Praliaskouski <me@komzpa.net>
Re: Re: Cast jsonb to numeric, int, float, bool David Steele <david@pgmasters.net>
Re: Re: Cast jsonb to numeric, int, float, bool Aleksander Alekseev <a.alekseev@postgrespro.ru>
Re: Cast jsonb to numeric, int, float, bool Teodor Sigaev <teodor@sigaev.ru>
Re: Cast jsonb to numeric, int, float, bool Teodor Sigaev <teodor@sigaev.ru>
Re: Cast jsonb to numeric, int, float, bool Teodor Sigaev <teodor@sigaev.ru>
Re: Cast jsonb to numeric, int, float, bool Robert Haas <robertmhaas@gmail.com>
Re: Cast jsonb to numeric, int, float, bool Teodor Sigaev <teodor@sigaev.ru>
Re: Cast jsonb to numeric, int, float, bool Aleksander Alekseev <a.alekseev@postgrespro.ru>
Re: Cast jsonb to numeric, int, float, bool Aleksander Alekseev <a.alekseev@postgrespro.ru>
Re: Cast jsonb to numeric, int, float, bool ilmari@ilmari.org (Dagfinn Ilmari Mannsåker)
Re: Cast jsonb to numeric, int, float, bool Robert Haas <robertmhaas@gmail.com>
Re: Cast jsonb to numeric, int, float, bool Teodor Sigaev <teodor@sigaev.ru>
Re: Cast jsonb to numeric, int, float, bool Tom Lane <tgl@sss.pgh.pa.us>
Re: Cast jsonb to numeric, int, float, bool Tom Lane <tgl@sss.pgh.pa.us>
Re: Cast jsonb to numeric, int, float, bool Teodor Sigaev <teodor@sigaev.ru>
Re: Cast jsonb to numeric, int, float, bool Tom Lane <tgl@sss.pgh.pa.us>
Re: Cast jsonb to numeric, int, float, bool Aleksander Alekseev <a.alekseev@postgrespro.ru>
Hi Tom,
I hadn't been following this thread particularly, but I happened to notice
this bit, and I thought I'd better pop up to say No Way. There will be
*no* implicit casts from json to any numeric type. We have learned the
hard way that implicit cross-category casts are dangerous.
I can see how a cast from text can be problematic, especially before the 'unknown' type.
But what would be the scenario of failure if we have an implicit cast from jsonb datatype (that likely already parsed the number internally, or knows it holds non-numeric value) to numeric, that returns an error if it's unable to perform the conversion?
The issue I think is that jsonb is special because it is in fact container. We've got dot-notation to unpack things from composite TYPE, and we've got arrow-notation to unpack things from jsonb, but such unpacking cannot take part in further computations, even though it's visually compatible.
What would be other options, if not implicit cast?
Darafei Praliaskouski,
GIS Engineer / Juno Minsk
GIS Engineer / Juno Minsk
В списке pgsql-hackers по дате отправления