Removing constraints

Started by Nathan Barnettover 25 years ago4 messagesgeneral
Jump to latest
#1Nathan Barnett
nbarnett@cellularphones.com

There is a constraint on my database that was created as part of a foreign
key. When I dropped the foreign key index, the constraint still remained
behind. How can I delete this constraint? It is unnamed and I figure I
need to remove some stuff from the system tables, but I don't know which
ones or what to delete. I'm using PostgreSQL v7.0.2. I looked through the
user guides, but couldn't find this info there.

---------------------------------------------
Nathan Barnett

#2Stephan Szabo
sszabo@megazone23.bigpanda.com
In reply to: Nathan Barnett (#1)
Re: Removing constraints

You should be able remove the fk constraint by dropping the three
associated triggers in pg_trigger. You can find the correct ones
by look at the tgargs column if you didn't name the constraint.

Stephan Szabo
sszabo@bigpanda.com

On Mon, 13 Nov 2000, Nathan Barnett wrote:

Show quoted text

There is a constraint on my database that was created as part of a foreign
key. When I dropped the foreign key index, the constraint still remained
behind. How can I delete this constraint? It is unnamed and I figure I
need to remove some stuff from the system tables, but I don't know which
ones or what to delete. I'm using PostgreSQL v7.0.2. I looked through the
user guides, but couldn't find this info there.

#3Nathan Barnett
nbarnett@cellularphones.com
In reply to: Stephan Szabo (#2)
RE: Removing constraints

Stephan,

Thanks for the initial help. I followed your instructions, but now I'm
getting an error: "ERROR: RelationBuildTriggers: 2 record(s) not found for
rel nametable". Where else would these triggers be referenced.

---------------------------------------------
Nathan Barnett

-----Original Message-----
From: pgsql-general-owner@postgresql.org
[mailto:pgsql-general-owner@postgresql.org]On Behalf Of Stephan Szabo
Sent: Monday, November 13, 2000 11:47 AM
To: Nathan Barnett
Cc: pgsql-general@postgresql.org
Subject: Re: [GENERAL] Removing constraints

You should be able remove the fk constraint by dropping the three
associated triggers in pg_trigger. You can find the correct ones
by look at the tgargs column if you didn't name the constraint.

Stephan Szabo
sszabo@bigpanda.com

On Mon, 13 Nov 2000, Nathan Barnett wrote:

There is a constraint on my database that was created as part of a foreign
key. When I dropped the foreign key index, the constraint still remained
behind. How can I delete this constraint? It is unnamed and I figure I
need to remove some stuff from the system tables, but I don't know which
ones or what to delete. I'm using PostgreSQL v7.0.2. I looked through

the

Show quoted text

user guides, but couldn't find this info there.

#4Tom Lane
tgl@sss.pgh.pa.us
In reply to: Nathan Barnett (#3)
Re: Removing constraints

"Nathan Barnett" <nbarnett@cellularphones.com> writes:

Thanks for the initial help. I followed your instructions, but now I'm
getting an error: "ERROR: RelationBuildTriggers: 2 record(s) not found for
rel nametable". Where else would these triggers be referenced.

If you manually add/delete triggers for a relation, you have to also
manually update the trigger count field in its entry in pg_class.

regards, tom lane