Hi, Hackers,
I have an fdw that each foreign table will acquire some persisted resource.
In my case, some files in file system. To drop the table cleanly, I have written
an object_access_hook that remove those files. The hook is installed in _PG_init.
It all worked well except one case. Suppose a user login, the very first command is
drop foreign table. Drop foreign table will not load the module, so that the hook
is not installed and the files are not properly cleaned up.
Should drop foreign table call GetFdwRoutine? _PG_init is the only entrance point
that I know for registering hooks, I feel we need to trigger a load for all DML/DDL on
FDW including drop. Does this make sense?
Thanks,
Feng