| From: | Peter Geoghegan <pg(at)bowt(dot)ie> |
|---|---|
| To: | PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
| Cc: | Amit Langote <amitlangote09(at)gmail(dot)com> |
| Subject: | Re: RI fast path gets cross-type foreign keys wrong |
| Date: | 2026-08-12 16:21:36 |
| Message-ID: | CAH2-Wz=D533JbF_ak_Pc8kP0FKse-ju8DnMxtjvY==yHsP4xgw@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On Fri, Jul 31, 2026 at 11:03 PM Peter Geoghegan <pg(at)bowt(dot)ie> wrote:
> The attached isolation test patch (written by Claude code) shows that
> the new RI fast path can get some things wrong when a foreign key uses
> a cross-type equality operator.
Opus 5 flagged an independent problem in the RI fast path work. This
one appears to be a resource management issue.
When I run the foreign_key tests with the attached patch applied, I
see these failures:
# END$$;
# CREATE TRIGGER fp_expand_kit_trg AFTER INSERT ON fp_order
# FOR EACH ROW EXECUTE FUNCTION fp_expand_kit();
# INSERT INTO fp_order VALUES (1, 1, 1);
# +WARNING: resource was not closed: relation "fp_product"
# +WARNING: resource was not closed: relation "fp_product_pkey"
# +WARNING: resource was not closed: TupleDesc 0x7f7e109a3448 (34085,-1)
# +WARNING: resource was not closed: TupleDesc 0x7f7e109a2cd8 (34068,-1)
# NOTICE: order 1 expanded into 3 order items
Right afterwards, "Assert(rel->rd_refcnt > 0)" fails within
RelationDecrementReferenceCount().
--
Peter Geoghegan
| Attachment | Content-Type | Size |
|---|---|---|
| 0001-Add-test-the-RI-fast-path-FK-cache-outlives-the-port.patch | application/octet-stream | 7.4 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Andrey Rachitskiy | 2026-08-12 16:23:06 | Re: [PATCH]Fix pg_xact corruption from subtransaction abort after subcommit |
| Previous Message | Hüseyin Demir | 2026-08-12 16:20:04 | Re: PSQL - improve tab completion for pub/sub options |