pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Luís Sousa <llsousa@ualg.pt>
Cc: pgsql-admin <pgsql-admin@postgresql.org>
Subject: Re: pg_restore and drop table problems
Date: Wed, 25 Oct 2006 18:54:42 -0400
Message-ID: <5986.1161816882@sss.pgh.pa.us> (raw)
In-Reply-To: <453F9B32.7090601@ualg.pt>
References: <453F9B32.7090601@ualg.pt>

=?ISO-8859-1?Q?Lu=EDs_Sousa?= <llsousa@ualg.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



view thread (2+ messages)

Message-ID: <5986.1161816882@sss.pgh.pa.us>
Permalink:  ../5986.1161816882@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/5986.1161816882@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-admin@postgresql.org
  Cc: tgl@sss.pgh.pa.us, llsousa@ualg.pt
  Subject: Re: pg_restore and drop table problems
  In-Reply-To: <5986.1161816882@sss.pgh.pa.us>
  References: <453F9B32.7090601@ualg.pt> <5986.1161816882@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox