Re: IS JSON predicate support for domain base type as JSON/JSONB/BYTEA/TEXT
jian he <jian.universality@gmail.com>
From: jian he <jian.universality@gmail.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: PostgreSQL-development <pgsql-hackers@postgresql.org>
Date: 2025-12-02T15:03:47Z
Lists: pgsql-hackers
Attachments
- v2-0001-IS-JSON-predicate-work-with-domain-type.patch (text/x-patch) patch v2-0001
On Wed, Nov 19, 2025 at 1:01 AM Tom Lane <tgl@sss.pgh.pa.us> wrote:
>
> jian he <jian.universality@gmail.com> writes:
> > [ v1-0001-IS-JSON-predicate-work-with-domain-type.patch ]
>
> This looks like a large patch with a small patch struggling to
> get out of it. Why didn't you simply do
>
> - *exprtype = exprType(expr);
> + *exprtype = getBaseType(exprType(expr));
>
> in transformJsonParseArg?
>
yech.
While at it, I added parser_errposition to the transformJsonIsPredicate ereport.
errmsg("cannot use type %s in IS JSON predicate",
format_type_be(exprtype))
we don't need to worry about exprtype as InvalidOid, because
transformJsonParseArg (exprType(expr)) would fail already in that case.
--
jian
https://www.enterprisedb.com/
Commits
-
Allow IS JSON predicate to work with domain types
- 3b4c2b9db25e 19 (unreleased) landed
-
SQL/JSON: support the IS JSON predicate
- 6ee30209a6f1 16.0 cited