Auto-delete large objects when referencing row is deleted
От | higepon |
---|---|
Тема | Auto-delete large objects when referencing row is deleted |
Дата | |
Msg-id | f07386410904052352h403e7a6et4452a041df8afb9d@mail.gmail.com обсуждение исходный текст |
Ответы |
Re: Auto-delete large objects when referencing row is deleted
|
Список | pgsql-hackers |
Hi. I found a TODO item "pg_dump Add dumping of comments on index columns" for large objects. and want to write a patch for it. I examined contrib/lo which offers this functionality. I have two plans, can anybody give me some advice on these? Plan A: (1) Define a new type for large object PostgreSQL stores blob columns as Oid type. But to delete large objects, we have to distinguish large objects as being different from Oid type objects. So a new type for large object, say "lo type" should be defined on pg_type.h . For compatibility with Oid values, we may add some code to pg_cast.h . (2) Define a trigger on create table When "create table" has large object type columns, PostgreSQL define a tirggerwhich delete large object on update/delete the row. We can use the trigger defined contrib/lo for this purpose. We may add hook code on "create table" at /src/backend/commands/tablecmds.c . (3) truncate/drop table On truncate table or drop table, the trigger can't be used. We have to handle this case. Plan B: This plan is quite simple. Merge contrib/vacumelo to VACUUM. (1) Define a new type for large object Same as Plan A. (unnecessary ?) (2) Delete on VACUUM On VACUUM, we check all tables which have "lo type", and delete un-referenced large objects. We may add a option "deleting large objects automatically" on VACUUM. Best regards, ----- Taro Minowa(Higepon) Cybozu Labs, Inc. http://www.monaos.org/ http://code.google.com/p/mosh-scheme/
В списке pgsql-hackers по дате отправления: