-- Minimal repro: a json_array() expression index over a composite type. -- 18 rejects the CREATE INDEX; 19 accepts it, and after ALTER TYPE the -- index scan and a sequential scan disagree until REINDEX. CREATE TYPE c AS (x int); CREATE TABLE t (v c); INSERT INTO t VALUES (ROW(1)); CREATE INDEX t_i ON t ((json_array(v RETURNING jsonb))); ALTER TYPE c ADD ATTRIBUTE y int; SET enable_seqscan = off; SELECT count(*) AS index_scan FROM t WHERE json_array(v RETURNING jsonb) = '[{"x": 1, "y": null}]'; RESET enable_seqscan; SET enable_indexscan = off; SET enable_bitmapscan = off; SELECT count(*) AS seq_scan FROM t WHERE json_array(v RETURNING jsonb) = '[{"x": 1, "y": null}]'; RESET ALL; REINDEX INDEX t_i; SET enable_seqscan = off; SELECT count(*) AS index_scan_after_reindex FROM t WHERE json_array(v RETURNING jsonb) = '[{"x": 1, "y": null}]';