Amit Langote <amitlangot...@gmail.com> writes:
> Updated patch attached.

This claim seems false on its face:

> All child constraints of a given foreign key constraint can use the
> same RI query and the resulting plan, that is, no need to create as
> many copies of the query and the plan as there are partitions, as
> happens now due to the child constraint OID being used in the key
> for ri_query_cache.

What if the child tables don't have the same physical column numbers
as the parent?  The comment claiming that it's okay if riinfo->fk_attnums
doesn't match seems quite off point, because the query plan is still
going to need to use the correct column numbers.  Even if column numbers
are the same, the plan would also contain table and index OIDs that could
only be right for one partition.

I could imagine translating a parent plan to apply to a child instead of
building it from scratch, but that would take a lot of code we don't have
(there's no rewriteHandler infrastructure for plan nodes).

Maybe I'm missing something, because I see that the cfbot claims
this is passing, and I'd sure like to think that our test coverage
is not so thin that it'd fail to detect probing the wrong partition
for foreign key matches.  But that's what it looks like this patch
will do.

                        regards, tom lane


Reply via email to