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
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
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 |
Modifiers
---------+------------------------+---------------------------------------------------------------
sernum | integer | not null default
nextval('public.diag_logs_sernum_seq'::text)
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,
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 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
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

In response to

Responses

Browse pgsql-sql by date

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