pg_restore --clean vs. large object

Поиск
Список
Период
Сортировка
От Itagaki Takahiro
Тема pg_restore --clean vs. large object
Дата
Msg-id 20090518165424.068D.52131E4D@oss.ntt.co.jp
обсуждение исходный текст
Ответы Re: pg_restore --clean vs. large object  (Jaime Casanova <jcasanov@systemguards.com.ec>)
Re: pg_restore --clean vs. large object  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
Hi,

Since pg_restore --clean doesn't delete existing large objects,
restoring to an existing database with "pg_restore --clean -1"
would fail if backup archive contains large objects. Some DBAs
complain to the behavior because they expect all existing data
conflicting with backup archive will be deleted automatically.

I'd like to improve the behavior if it is not intentional.
The attached is a patch to execute lo_unlink() before lo_create()
in pg_restore. To avoid transaction rollbacks, I added a test
whether the large object exists with an EXISTS query.

    SELECT CASE WHEN EXISTS
        (SELECT 1 FROM pg_catalog.pg_largeobject WHERE loid = %u)
      THEN lo_unlink(%u) END;

Comments welcome.

Regards,
---
ITAGAKI Takahiro
NTT Open Source Software Center

Вложения

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

Предыдущее
От: Rodrigo E. De León Plicet
Дата:
Сообщение: Re: WAL dump tool
Следующее
От: Pavel Stehule
Дата:
Сообщение: problem with polymorphic functions and implicit casting