| From: | Andrew Dunstan <andrew(at)dunslane(dot)net> |
|---|---|
| To: | pgsql-committers(at)lists(dot)postgresql(dot)org |
| Subject: | pgsql: Allow IS JSON predicate to work with domain types |
| Date: | 2026-03-17 19:22:33 |
| Message-ID: | E1w2Zzt-000D0d-07@gemulon.postgresql.org |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | 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(dot)universality(at)gmail(dot)com>
Reviewed-by: Andrew Dunstan <andrew(at)dunslane(dot)net>
Reviewed-by: Kirill Reshke <reshkekirill(at)gmail(dot)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(-)
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Michael Paquier | 2026-03-18 02:05:09 | pgsql: test_plan_advice: Add .gitignore |
| Previous Message | Andres Freund | 2026-03-17 18:55:05 | pgsql: Fix use of wrong variable in _hash_kill_items() |