Re: json/jsonb cleanup + FmgrInfo caching

From: jian he <jian(dot)universality(at)gmail(dot)com>
To: Manu <manuelreyesbravo(at)gmail(dot)com>
Cc: shihao zhong <zhong950419(at)gmail(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: json/jsonb cleanup + FmgrInfo caching
Date: 2026-10-22 13:12:53
Message-ID: CACJufxHQJ=5ee1FMhKqNjZ4TAX4q6dWsGiEEJJGgb1AhCF1cgA@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sun, Oct 18, 2026 at 12:32 PM Manu <manuelreyesbravo(at)gmail(dot)com> wrote:
>
> shihao zhong <zhong950419(at)gmail(dot)com> writes:
> > Named composite types still have the problem. ALTER TYPE can add a
> > timestamptz after the index is built.
>
> I measured this on 18.6, 19rc1 and master, and it is broader than a mutable
> attribute: a pure structural change does it too, with no mutable type and no
> GUC. Adding a plain int attribute is enough.
>
> CREATE TYPE c1 AS (x int);
> CREATE TABLE t1 (v c1);
> INSERT INTO t1 VALUES (row(1));
> CREATE INDEX t1_i ON t1 ((json_array(v returning jsonb)));
> ALTER TYPE c1 ADD ATTRIBUTE y int;
> SELECT count(*) FROM t1
> WHERE json_array(v returning jsonb) =
> json_array(row(1, null)::c1 returning jsonb);
>
> The index scan returns 0 and a seq scan returns 1; REINDEX restores 1, so the

The attached patch should resolve these issues.

Note that float8out and float4out are considered immutable for PG19,
we can only change this in PG20.
see https://www.postgresql.org/message-id/19644-d6db3fb5e5ad92f4%40postgresql.org

--
jian
https://www.enterprisedb.com/

Attachment Content-Type Size
v3-0001-Don-t-treat-record-json-b-conversions-as-immutable.txt text/plain 17.8 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Langote 2026-10-22 13:14:11 Re: PG19: two RI fast-path issues found while testing the batching revert
Previous Message Nitin Motiani 2026-10-22 12:48:17 Re: [PATCH v1] Fix for bug #19770 : Reject NO INHERIT not-null constraints copied by LIKE to partitioned tables