Re: pg_restore and drop table problems

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Luís Sousa <llsousa(at)ualg(dot)pt>
Cc: pgsql-admin <pgsql-admin(at)postgresql(dot)org>
Subject: Re: pg_restore and drop table problems
Date: 2006-10-25 22:54:42
Message-ID: 5986.1161816882@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

=?ISO-8859-1?Q?Lu=EDs_Sousa?= <llsousa(at)ualg(dot)pt> writes:
> Steps to reproduce:
> 1. pg_dump with -Fc option from database
> 2. A column name on table C is changed
> 3. pg_restore using option -S and --disable-triggers with error
> identifying that a column on table C was changed
> 4. drop table B. Can't drop table giving ERROR: relation "B" has
> reltriggers = 0

--disable-triggers in 7.x is a crude hack that works by munging the
system catalogs (specifically pg_class.reltriggers). You need to
un-munge the catalog entries in the way that pg_restore evidently
didn't have a chance to do.

UPDATE pg_catalog.pg_class SET reltriggers =
(SELECT pg_catalog.count(*) FROM pg_catalog.pg_trigger
WHERE pg_class.oid = tgrelid)
FROM pg_catalog.pg_namespace
WHERE relnamespace = pg_namespace.oid AND nspname !~ '^pg_';

regards, tom lane

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Joshua Marsh 2006-10-25 23:23:39 Re: CLUSTER using more memory than expected
Previous Message Tom Lane 2006-10-25 22:49:48 Re: CLUSTER using more memory than expected