Re: why doesn't DestroyPartitionDirectory hash_destroy? - Mailing list pgsql-hackers

From Tom Lane
Subject Re: why doesn't DestroyPartitionDirectory hash_destroy?
Date
Msg-id 5230.1552583761@sss.pgh.pa.us
Whole thread Raw
In response to Re: why doesn't DestroyPartitionDirectory hash_destroy?  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: why doesn't DestroyPartitionDirectory hash_destroy?
List pgsql-hackers
I wrote:
> Agreed, but the comments in this area are crap.

Actually, now that I've absorbed a bit more about 898e5e329,
I don't like very much about it at all.  I think having it
try to hang onto pointers into the relcache is a completely
wrongheaded design decision, and the right way for it to work
is to just copy the PartitionDescs out of the relcache so that
they're fully owned by the PartitionDirectory.  I don't see
a CopyPartitionDesc function anywhere (maybe it's named something
else?) but it doesn't look like it'd be hard to build; most
of the work is in partition_bounds_copy() which does exist already.

Also, at least so far as the planner's usage is concerned, claiming
that we're saving something by not copying is completely bogus,
because if we look into set_relation_partition_info, what do we
find but a partition_bounds_copy call.  That wouldn't be necessary
if we could rely on the PartitionDirectory to own the data structure.
(Maybe it's not necessary today.  But given what a house of cards
this is, I wouldn't propose ripping it out, just moving it into
the PartitionDirectory code.)

            regards, tom lane


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: why doesn't DestroyPartitionDirectory hash_destroy?
Next
From: Robert Haas
Date:
Subject: Re: hyrax vs. RelationBuildPartitionDesc