Re: Re: [BUGS] BUG #7873: pg_restore --clean tries to drop tables that don't exist

From: Andres Freund <andres(at)2ndquadrant(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Tomas Vondra <tv(at)fuzzy(dot)cz>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Re: [BUGS] BUG #7873: pg_restore --clean tries to drop tables that don't exist
Date: 2013-11-10 23:32:47
Message-ID: 20131110233247.GH32665@awork2.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

On 2013-11-10 18:26:26 -0500, Tom Lane wrote:
> Andres Freund <andres(at)2ndquadrant(dot)com> writes:
> > On 2013-11-10 18:16:16 -0500, Tom Lane wrote:
> >> Then I take it you also think we should undo the changes that made
> >> "DROP TABLE IF EXISTS foo.bar" not fail if schema foo doesn't exist?
> >> Because after all, the schema is not the object being dropped.
>
> > No, not the same thing imo, although I find that change debatable.
>
> > Anyway, if we're going to change DROP TRIGGER at the very least ALTER
> > TABLE ... DROP CONSTRAINT also needs to be changed, otherwise we'll gain
> > nothing.
>
> That would be a plausible next step, but I don't have a problem with
> this patch not solving every case like this at once.

Well, there are relatively few tables without primary keys around that
have triggers. The dumps currently look like:
DROP TRIGGER foo ON public.foo;
ALTER TABLE ONLY public.foo DROP CONSTRAINT foo_pkey;
ALTER TABLE public.foo ALTER COLUMN id DROP DEFAULT;
DROP SEQUENCE public.foo_id_seq;
DROP TABLE public.foo;
So we'd get approximately one line further unless we fix this for DROP
DEFAULT and DROP CONSTRAINT as well.

Greetings,

Andres Freund

--
Andres Freund http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2013-11-10 23:42:11 Re: Re: [BUGS] BUG #7873: pg_restore --clean tries to drop tables that don't exist
Previous Message Tom Lane 2013-11-10 23:26:26 Re: Re: [BUGS] BUG #7873: pg_restore --clean tries to drop tables that don't exist

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2013-11-10 23:42:11 Re: Re: [BUGS] BUG #7873: pg_restore --clean tries to drop tables that don't exist
Previous Message Tom Lane 2013-11-10 23:26:26 Re: Re: [BUGS] BUG #7873: pg_restore --clean tries to drop tables that don't exist