Re: finish TODOs in to_json_is_immutable, to_jsonb_is_immutable also add tests on it

jian he <jian.universality@gmail.com>

From: jian he <jian.universality@gmail.com>
To: PostgreSQL-development <pgsql-hackers@postgresql.org>
Date: 2025-05-28T06:55:16Z
Lists: pgsql-hackers

Attachments

On Mon, May 19, 2025 at 9:09 AM jian he <jian.universality@gmail.com> wrote:
>
> hi.
>
> somehow, I accidentally saw the TODOs (commits [3]) on jsonb.c and json.c
> for functions: to_json_is_immutable and to_jsonb_is_immutable.
> The attached patch is to finalize these TODOs.
>
> per coverage [1], [2],  there was zero coverage for these two functions.
> so I also added extensive tests on it.
>

I didn't include "utils/rel.h", so v1-0001 won't compile.
The tests were overly verbose,
so I removed some unnecessary ones to simplify them.

Commits

  1. make immutability tests in to_json and to_jsonb complete

  2. Include error location in errors from ComputeIndexAttrs().

  3. SQL/JSON: add standard JSON constructor functions