Re: Constraints/Triggers information?

From: Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>
To: Tim Ellis <Tim(dot)Ellis(at)gamet(dot)com>
Cc: <pgsql-admin(at)postgresql(dot)org>
Subject: Re: Constraints/Triggers information?
Date: 2002-06-28 00:04:54
Message-ID: 20020627170146.H10858-100000@megazone23.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin


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 "<triggername>" on <table> 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.

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Tim Ellis 2002-06-28 00:20:39 Dia --> SQL (tedia2sql 0.58 Released
Previous Message Tim Ellis 2002-06-27 23:13:32 Constraints/Triggers information?