| From: | Nikolay Samokhvalov <nik(at)postgres(dot)ai> |
|---|---|
| To: | pgsql-hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
| Cc: | Amit Langote <amitlangote09(at)gmail(dot)com> |
| Subject: | [PATCH] Invalidate cached plans when casts change |
| Date: | 2026-09-15 02:12:30 |
| Message-ID: | CAM527d9hN9m9kz3-hO-teFGjnX6biQsMn3NW2kM7dK_KT8jRZA@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
While testing the RI fixes with my AI harness, I found a separate
invalidation hole in plancache.c. A prepared statement keeps using the
old cast function after the cast is replaced, while direct SQL uses the
new one. This reproduces without the RI patches, with both functions
created before prepare.
Attached is a standalone fix registering CASTSOURCETARGET with
PlanCacheSysCallback, plus a regression test. I reproduced it on master,
PG18 and PG14, including generic/custom plans and DDL from another
session. Regression and isolation pass with the fix on all three.
The patch applies unchanged to current PG14–19 and master. PG15–17 and
PG19 were checked for source and patch applicability only.
Thanks,
Nik
| Attachment | Content-Type | Size |
|---|---|---|
| v1-0001-Invalidate-cached-plans-when-casts-change.patch | application/x-patch | 4.5 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Nikolay Samokhvalov | 2026-09-15 02:13:54 | Re: PG19: two RI fast-path issues found while testing the batching revert |
| Previous Message | Nikolay Samokhvalov | 2026-09-15 02:11:55 | Re: PG19 FK fast path: OOB write and missed FK checks during batched |