Re: trigger/for key help - Mailing list pgsql-sql

From Bret Hughes
Subject Re: trigger/for key help
Date
Msg-id 1081711155.6399.165.camel@bretsony
Whole thread Raw
In response to Re: trigger/for key help  (Stephan Szabo <sszabo@megazone.bigpanda.com>)
Responses Re: trigger/for key help
List 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          |
                    
 
Modifiers                           
---------+------------------------+---------------------------------------------------------------sernum  | integer
          | not null default
 
nextval('public.diag_logs_sernum_seq'::text)display | integer                | not nulltdate   | date
|not nullttime   | time without time zone | not nulltstatus | smallint               | not nullttype   | smallint
       | not null
 
Indexes: diag_logs_display,        diag_logs_tdate,        diag_logs_tstatus
Primary key: diag_logs_pkey



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

and

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

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


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.

TIA 

Bret



pgsql-sql by date:

Previous
From: elein
Date:
Subject: Re: SQL challenge--top 10 for each key value?
Next
From: "Dennis"
Date:
Subject: Re: cursors and for loops?