pgsql: Allow IS JSON predicate to work with domain types - Mailing list pgsql-committers

From Andrew Dunstan
Subject pgsql: Allow IS JSON predicate to work with domain types
Date
Msg-id E1w2Zzt-000D0d-07@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
Allow IS JSON predicate to work with domain types

The IS JSON predicate only accepted the base types text, json, jsonb, and
bytea.  Extend it to also accept domain types over those base types by
resolving through getBaseType() during parse analysis.

The base type OID is stored in the JsonIsPredicate node (as exprBaseType)
so the executor can dispatch to the correct validation path without
repeating the domain lookup at runtime.

When a non-supported type (or domain over a non-supported type) is used,
the error message displays the original type name as written by the user,
rather than the resolved base type.

Author: jian he <jian.universality@gmail.com>
Reviewed-by: Andrew Dunstan <andrew@dunslane.net>
Reviewed-by: Kirill Reshke <reshkekirill@gmail.com>
Discussion: https://postgr.es/m/CACJufxEk34DnJFG72CRsPPT4tsJL9arobX0tNPsn7yH28J=zQg@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/3b4c2b9db25ee1c51e5133da529668a37aa02fc3

Modified Files
--------------
src/backend/executor/execExprInterp.c |  4 +--
src/backend/nodes/makefuncs.c         |  3 +-
src/backend/parser/gram.y             |  8 ++---
src/backend/parser/parse_expr.c       | 11 ++++---
src/include/nodes/makefuncs.h         |  2 +-
src/include/nodes/primnodes.h         |  1 +
src/test/regress/expected/sqljson.out | 57 +++++++++++++++++++++++++++++++++++
src/test/regress/sql/sqljson.sql      | 31 +++++++++++++++++++
8 files changed, 103 insertions(+), 14 deletions(-)


pgsql-committers by date:

Previous
From: Andres Freund
Date:
Subject: pgsql: Fix use of wrong variable in _hash_kill_items()
Next
From: Michael Paquier
Date:
Subject: pgsql: test_plan_advice: Add .gitignore