Skip site navigation (1) Skip section navigation (2)

Re: trigger/for key help

From: Bret Hughes <bhughes(at)elevating(dot)com>
To: Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com>
Cc: postgresql sql list <pgsql-sql(at)postgresql(dot)org>
Subject: Re: trigger/for key help
Date: 2004-04-11 19:19:14
Message-ID: 1081711155.6399.165.camel@bretsony (view raw, whole thread or download thread mbox)
Lists: pgsql-sql
On Sun, 2004-04-11 at 10:17, Stephan Szabo wrote:
> On Sat, 11 Apr 2004, Bret Hughes wrote:
> > S*t s*t s*t.  I have managed to screw up the system tables trying to
> > delete a foreign key on a new table I was going to start using tomorrow.
> >
> >

> > elevating=# drop table diag_logs;
> > ERROR:  2 trigger record(s) not found for relation "diag_logs"
> This is because reltriggers in the pg_class row for the table in question
> is incorrect.  You can fix this by updating the rows (*).  You'll probably
> want to fix pg_constraint as well, but I think that the table will
> function properly at least until you try to dump it.
> (*) something like this should work
>  update pg_class set reltriggers=(select count(*) from pg_trigger where
> tgrelid=pg_class.oid) where relname='<insert name here>';

ok I updated the rows by relname individually so I could limit issues
should I screw it up.

I can now get a dump of the db but still cannot drop the two tables I
added.  I get a different message now :

elevating=# \d diag_logs;
                                        Table "diag_logs"
 Column  |          Type          |                          
 sernum  | integer                | not null default
 display | integer                | not null
 tdate   | date                   | not null
 ttime   | time without time zone | not null
 tstatus | smallint               | not null
 ttype   | smallint               | not null
Indexes: diag_logs_display,
Primary key: diag_logs_pkey

elevating=# drop table diag_logs;
ERROR:  could not find tuple for constraint 2041954


elevating=# \d test_types;
                 Table "test_types"
     Column     |     Type      |     Modifiers      
 num            | smallint      | not null
 progname       | character(25) | not null
 severity_level | smallint      | not null default 1
Primary key: test_types_pkey

elevating=# drop table test_types;
ERROR:  could not find tuple for constraint 2041971

I can find no reference to these oids anywhere.

I wasgonig to restart postmaster incase something is cached but I hate
to since I don't know if it will restart properly.



In response to


pgsql-sql by date

Next:From: Tom LaneDate: 2004-04-11 22:00:13
Subject: Re: trigger/for key help
Previous:From: DennisDate: 2004-04-11 18:46:01
Subject: Re: cursors and for loops?

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group