Re: FDW: should GetFdwRoutine be called when drop table?

Поиск
Список
Период
Сортировка
От Andres Freund
Тема Re: FDW: should GetFdwRoutine be called when drop table?
Дата
Msg-id 20160219193327.oqd2gvgc2rm3rnsk@alap3.anarazel.de
обсуждение исходный текст
Ответ на Re: FDW: should GetFdwRoutine be called when drop table?  (Peter Eisentraut <peter_e@gmx.net>)
Ответы Re: FDW: should GetFdwRoutine be called when drop table?  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
On 2016-02-19 14:18:19 -0500, Peter Eisentraut wrote:
> On 2/19/16 12:21 PM, Feng Tian wrote:
> > 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.
> 
> You could load your library with one of the *_library_preload settings
> to make sure the hook is always present.
> 
> But foreign data wrappers are meant to be wrappers around data managed
> elsewhere, not their own storage managers (although that is clearly
> tempting), so there might well be other places where this breaks down.

Sounds like even a BEGIN;DROP TABLE foo;ROLLBACK; will break this
approach.

Andres



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Peter Eisentraut
Дата:
Сообщение: Re: FDW: should GetFdwRoutine be called when drop table?
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Restructuring Paths to allow per-Path targetlist info