Received: from localhost.localdomain (postgresql.org [64.49.215.8]) by localhost (Postfix) with ESMTP id 0976447597A for ; Thu, 27 Jun 2002 20:05:06 -0400 (EDT) Mailbox-Line: From sszabo@megazone23.bigpanda.com Thu Jun 27 20:05:06 2002 Received: from megazone.bigpanda.com (megazone.bigpanda.com [63.150.15.178]) by postgresql.org (Postfix) with ESMTP id A40F3475932 for ; Thu, 27 Jun 2002 20:04:51 -0400 (EDT) Received: by megazone.bigpanda.com (Postfix, from userid 1001) id 93E96D609; Thu, 27 Jun 2002 17:04:54 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by megazone.bigpanda.com (Postfix) with ESMTP id 899755C02; Thu, 27 Jun 2002 17:04:54 -0700 (PDT) Date: Thu, 27 Jun 2002 17:04:54 -0700 (PDT) From: Stephan Szabo To: Tim Ellis Cc: Subject: Re: Constraints/Triggers information? In-Reply-To: <20020627161332.765f5c04.Tim.Ellis@gamet.com> Message-ID: <20020627170146.H10858-100000@megazone23.bigpanda.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Spam-Status: No, hits=-3.6 required=5.0 tests=IN_REP_TO,X_NOT_PRESENT,SUBJ_ENDS_IN_Q_MARK,NO_MX_FOR_FROM version=2.30 X-Spam-Level: X-Archive-Number: 200206/222 X-Sequence-Number: 4656 On Thu, 27 Jun 2002, Tim Ellis wrote: > --------------------------------------------------- > alter table license drop constraint fk_lic_lc restrict ; > drop table license ; > create table license ( > id numeric(18), > . . . > ) ; > alter table license add constraint fk_lic_lc > foreign key (license_code_id) references license_code (id) ; > --------------------------------------------------- > > Where the final statement had previously run successfully: > > --------------------------------------------------- > psql:file.sql:284: NOTICE: > ALTER TABLE will create implicit trigger(s) for FOREIGN KEY check(s) > --------------------------------------------------- > > The initial statement (alter table drop constraint) always fails with > > --------------------------------------------------- > psql:file.sql:22: ERROR: ALTER TABLE / DROP CONSTRAINT: > fk_lic_lc does not exist Current PostgreSQL's drop constraint only works on check constraints. To drop foreign keys, you have to do, drop trigger "" on for the three triggers it creates (2 on the pk table, 1 on the fk table). > But I can't get any information on the RI_ entries. What's wrong with me? > Do I need to RTFM? If so, which FM do I need to R? Pretty much the most useful info on the triggers can be found on techdocs.postgresql.org. There are a couple of essays on them.