Add casts from jsonb

Enterprise / PostgreSQL - Teodor Sigaev [sigaev.ru] - 29 March 2018 13:33 EDT

Add explicit cast from scalar jsonb to all numeric and bool types. It would be better to have cast from scalar jsonb to text too but there is already a cast from jsonb to text as just text representation of json. There is no way to have two different casts for the same type's pair.

Bump catalog version

Author: Anastasia Lubennikova with editorization by Nikita Glukhov and me Review by: Aleksander Alekseev, Nikita Glukhov, Darafei Praliaskouski Discussion: https://www.postgresql.org/message-id/flat/0154d35a-24ae-f063-5273-9ffcdf1c7f2e@postgrespro.ru

c0cbe00fee Add casts from jsonb
src/backend/utils/adt/jsonb.c | 175 ++++++++++++++++++++++++++++++++++++
src/include/catalog/catversion.h | 2 +-
src/include/catalog/pg_cast.h | 9 ++
src/include/catalog/pg_proc.h | 16 ++++
src/test/regress/expected/jsonb.out | 105 ++++++++++++++++++++++
src/test/regress/sql/jsonb.sql | 22 +++++
6 files changed, 328 insertions(+), 1 deletion(-)

Upstream: git.postgresql.org


  • Share