This unfortunately can't be supported in pg11. Current code is currently
broken, so later commit will add a proper fix to disable runtime partition
pruning on hypothetically partitioned tables.
Previous naive implementation was storing the hypothetical partitions in
a simple List, which would definitely not scale if many hypothetical
partitions are stored.
The partition's children oid are also now maintained in each hypoTable
entry, for performance reason too.
Some minor fixup too while at it.
The underlying C function was already existing, I just forgot to add the
SQL wrapper.
The C function is modified to add an error if the function is called on
a non hypothetically partitioned table instead of silently doing
nothing, and add regression tests.
Register a relcache callback, filter the relid list to keep only the one
corresponding to table that are hypothetically partitioned and
asynchronously process them. We only care about table being dropped, so
in order to detect that we check if the relid we stored still correspond
to a table whose name is the same as the one we recorded when creating
the hypothetical objects.
This will fail on pg10- servers, but since hypothetical partitioning has
some feature not covered by regression tests, a full coverage of hypopg for all
pg versions will be done in other commit(s).