Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id 2E50D9FB3B9 for ; Wed, 25 Oct 2006 19:54:49 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 41583-09 for ; Wed, 25 Oct 2006 19:54:45 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id 4391B9FB278 for ; Wed, 25 Oct 2006 19:54:45 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id k9PMsgCD005987; Wed, 25 Oct 2006 18:54:43 -0400 (EDT) To: =?ISO-8859-1?Q?Lu=EDs_Sousa?= cc: pgsql-admin Subject: Re: pg_restore and drop table problems In-reply-to: <453F9B32.7090601@ualg.pt> References: <453F9B32.7090601@ualg.pt> Comments: In-reply-to =?ISO-8859-1?Q?Lu=EDs_Sousa?= message dated "Wed, 25 Oct 2006 18:13:22 +0100" Date: Wed, 25 Oct 2006 18:54:42 -0400 Message-ID: <5986.1161816882@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.127 tagged_above=0 required=5 tests=AWL, SPF_HELO_PASS, SPF_PASS X-Spam-Level: X-Archive-Number: 200610/168 X-Sequence-Number: 23471 =?ISO-8859-1?Q?Lu=EDs_Sousa?= 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