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

Поиск
Список
Период
Сортировка
От Darafei Praliaskouski
Тема Re: Cast jsonb to numeric, int, float, bool
Дата
Msg-id 151985418868.6915.17223208131889314092.pgcf@coridan.postgresql.org
обсуждение исходный текст
Ответ на Re: [HACKERS] Cast jsonb to numeric, int, float, bool  (Anastasia Lubennikova <a.lubennikova@postgrespro.ru>)
Ответы Re: Cast jsonb to numeric, int, float, bool
Список pgsql-hackers
The following review has been posted through the commitfest application:
make installcheck-world:  tested, passed
Implements feature:       tested, passed
Spec compliant:           tested, passed
Documentation:            not tested

We're using this patch and like it a lot.

We store a lot of log-like data in s3-hosted .json.gz files.
Sometimes we need to suddenly ingest them and calculate statistics and check the new what-ifs.
We ingest data to simple single-column table with jsonb field, and then perform our calculation on top of it.
Without this patch the only option to get data already parsed as numbers into jsonb into calculation is via
binary-text-binarytransformation.
 

We're relying on the patch for our custom spatial type extension and casting in it.
https://github.com/gojuno/lostgis/blob/master/sql/types/type_tpv.sql#L21 

For postgres installations without the patch we do WITH INOUT cast stubbing,
https://github.com/gojuno/lostgis/blob/master/sql/types/__jsonb_casts.sql
- but without performance benefits of raw C processing :)

A thing this patch does not implement is cast from jsonb to bigint.
That would be useful for transforming stored osm_id OpenStreetMap object identifiers.
Right now we're stubbing it with jsonb::numeric::bigint cast, but the middle one would be nice to get rid of.

The new status of this patch is: Ready for Committer

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Tomas Vondra
Дата:
Сообщение: Re: Online enabling of checksums
Следующее
От: Andres Freund
Дата:
Сообщение: RFC: Add 'taint' field to pg_control.