proposal: fault tolerant DROP XXXX IF name

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: proposal: fault tolerant DROP XXXX IF name
Date: 2013-07-02 11:32:50
Message-ID: CAFj8pRCw3ADLSrC=fpvDcCcgF2K8GDLw3HkMgkpwm59_9ttPOQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello

I would to continue on implementation --if-exists option (using
conditional DROP statements) for pg_dump

related discussion

http://www.postgresql.org/message-id/CAFj8pRDwqTXnc+rEUAVc4H5Hx1F_0hKNA-9F+2FgCu18aXtY4A@mail.gmail.com

Actually, we are not able to do simple implementation due double check
(dependency check) in DROP STATEMENTS

small example

create or replace function fg() returns setof omega as $$ select *
from omega $$ language sql;
create or replace function fg(a omega) returns setof omega as $$
select * from omega $$ language sql;

There is dependency fg function on table omega.

Dump cleanup section:

DROP FUNCTION IF EXISTS public.fg(a omega);
DROP TABLE IF EXISTS public.omega;
DROP EXTENSION IF EXISTS plpgsql;
DROP SCHEMA IF EXISTS public;

But DROP FUNCTION fails due missing table omega

SET
ERROR: type "omega" does not exist

so we are not able to reload dump inside transaction.

so my proposal:

two ways

* do conditional drops fully fault tolerant - it show only notice instead error

or

* decrease level of exceptions in conditional drops to WARNINGS

Ideas, comments??

Regards

Pavel

Browse pgsql-hackers by date

  From Date Subject
Next Message Pavel Stehule 2013-07-02 11:47:07 Re: [BUGS] BUG #7873: pg_restore --clean tries to drop tables that don't exist
Previous Message Pavel Stehule 2013-07-02 11:05:36 Re: [BUGS] BUG #7873: pg_restore --clean tries to drop tables that don't exist