X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 2758BD1D06C for ; Sun, 11 Apr 2004 16:19:26 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 04703-07 for ; Sun, 11 Apr 2004 16:19:30 -0300 (ADT) Received: from mail1.elevating.com (wsip-68-99-77-237.tu.ok.cox.net [68.99.77.237]) by svr1.postgresql.org (Postfix) with ESMTP id 0296FD1BB89 for ; Sun, 11 Apr 2004 16:19:24 -0300 (ADT) Received: from bretsony.hugheshome.org (bretsony.brets.elevating.com [10.23.0.50]) (authenticated) by mail1.elevating.com (8.11.6/8.11.6) with ESMTP id i3BJJFF04439; Sun, 11 Apr 2004 14:19:15 -0500 Subject: Re: trigger/for key help From: Bret Hughes To: Stephan Szabo Cc: postgresql sql list In-Reply-To: <20040411080932.Q83278@megazone.bigpanda.com> References: <1081662204.6609.72.camel@bretsony> <20040411080932.Q83278@megazone.bigpanda.com> Content-Type: text/plain Content-Transfer-Encoding: 7bit X-Mailer: Ximian Evolution 1.0.8 (1.0.8-9.7x.1) Date: 11 Apr 2004 14:19:14 -0500 Message-Id: <1081711155.6399.165.camel@bretsony> Mime-Version: 1.0 X-Elevating-MailScanner: Found to be clean X-Elevating-MailScanner-SpamCheck: not spam, SpamAssassin (score=-1.5, required 5, BAYES_00 -1.50) X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200404/108 X-Sequence-Number: 17483 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=''; > 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