RE: FOREIGN KEY - Mailing list pgsql-general

From Trewern, Ben
Subject RE: FOREIGN KEY
Date
Msg-id 996802F75C3CD411B424001083FA445B05957B@CET_PONXX_FP001
Whole thread Raw
In response to FOREIGN KEY  ("Andras Balogh" <abalogh@grafx.ro>)
List pgsql-general

Hi,

Foreign Keys are implemented with triggers and you can list thim all by doing a 'SELECT * FROM pg_trigger;'.   The triggers starting with RI_ConstraintTrigger_?????? are those in question, but which trigger goes with which foreign key is not obvious.  If you have named the Foriegn keys then it should not be too much problem.  Otherwise you should me able to make it out from the tgargs field.  When you have found out which triggers you need to drop use DROP TRIGGER ... to remove them.

You can add the Foreign keys again after you have copied all the data with ALTER TABLE ...

Hope this helps

Ben

> -----Original Message-----
> From: Andras Balogh [mailto:abalogh@grafx.ro]
> Sent: 04 July 2001 14:46
> To: pgsql-general@postgresql.org
> Subject: [GENERAL] FOREIGN KEY
>
>
> Hi,
>
> I have created a table is postgres with a FOREIGN KEY reference to
> another table.
> I am using the COPY command to copy the data from a file to this table.
> I am getting this error:
> referential integrity violation - key referenced from A not found in B
>
> I understand that I am inserting a row in A with an id that is not in table B,
> I want to ignore those inserts that are violating the referential integrity.
> What should i do? 
>
> Aslo i didn't find a way to list the FOREIGN KEYS in a table
> \d <tablename> it gives only the structure.
>
> Any input is welcomed,
>
> Andras.

*****************************************************************************
This email and any attachments transmitted with it are confidential
and intended solely for the use of the individual or entity to whom
they are addressed. If you have received this email in error please
notify the sender and do not store, copy or disclose the content
to any other person.

It is the responsibility of the recipient to ensure that opening this
message and/or any of its attachments will not adversely affect
its systems. No responsibility is accepted by the Company.
*****************************************************************************

pgsql-general by date:

Previous
From: Ryan Mahoney
Date:
Subject: postgres and unix time format
Next
From: Tom Lane
Date:
Subject: Re: Re: lo wrappers - still working on it