Re: [PATCH] Invalidate cached plans when casts change - Mailing list pgsql-hackers

From Nikolay Samokhvalov
Subject Re: [PATCH] Invalidate cached plans when casts change
Date
Msg-id CAM527d-8tXT=b0N4y6tdsri7ZfJVq7SN=Hp_SY5hhh04mQ9QZQ@mail.gmail.com
Whole thread
Responses Re: [PATCH] Invalidate cached plans when casts change
List pgsql-hackers
For completeness, here's the exact reproducer I should have included:

drop schema if exists cast_repro cascade;
create schema cast_repro;
set search_path = cast_repro, pg_catalog;

create type key_t as (v int);
create function cast_old(key_t) returns int
language sql immutable strict as 'select ($1).v';
create function cast_new(key_t) returns int
language sql immutable strict as 'select ($1).v + 100';

create cast (key_t as int) with function cast_old(key_t) as implicit;
prepare q(key_t) as select $1::int;
execute q(row(1)::key_t);

drop cast (key_t as int);
create cast (key_t as int) with function cast_new(key_t) as implicit;
select row(1)::key_t::int as direct_after;
execute q(row(1)::key_t);

On unpatched master this returns 1, 101, 1. The last value should be 101.
With the patch it returns 1, 101, 101.

Thanks,
Nik



Attachment

pgsql-hackers by date:

Previous
From: Nikolay Samokhvalov
Date:
Subject: Re: PG19: two RI fast-path issues found while testing the batching revert
Next
From: Amit Kapila
Date:
Subject: Re: Distinguish publication exclusions in object addresses