Re: Adjustment to "Problem with dropping a FOREIGN KEY" - Mailing list pgsql-general

From Richard Huxton
Subject Re: Adjustment to "Problem with dropping a FOREIGN KEY"
Date
Msg-id 004701c0b600$42243be0$1001a8c0@archonet.com
Whole thread Raw
In response to Adjustment to "Problem with dropping a FOREIGN KEY"  (Harry Yau <harry.yau@regaltronic.com>)
List pgsql-general
From: "Harry Yau" <harry.yau@regaltronic.com>

> Dear:
>     Hi everybody, I've just found the pg_trigger and pg_class, but I am
> wondering how can i modify this two file. I've used VI to view it, but
> it appear in some strange font of character. Now, I start wonder are
> they actually text files or application program.
> If they were files, please tell me how can I delete or modify the
> context of these two file; otherwise, please show me how may I use them
> to drop the constraint trigger that was created by add foreign key.

They're database tables - don't use a text editor on them!

You can get a listing of all the system tables with \dS - they should all
begin with pg_

You can use normal queries to update the pg_triggers and pg_class tables (if
you have the right permissions - database owner should be good). You might
want to pg_dump things first in case of any problems.

Basically, I think postgres gets confused if the reltriggers count is zero
while you still have a trigger left in pg_triggers.

There is some information on system tables in the developer's docs at
www.postgresql.org

- Richard Huxton


pgsql-general by date:

Previous
From: Daniel Hartmeier
Date:
Subject: Integrity violation when adding foreign key constraint
Next
From: "Mitch Vincent"
Date:
Subject: Re: Free Text Search