From: | "Trewern, Ben" <Ben(dot)Trewern(at)mowlem(dot)com> |
---|---|
To: | "'Andras Balogh'" <abalogh(at)grafx(dot)ro>, pgsql-general(at)postgresql(dot)org |
Subject: | RE: FOREIGN KEY |
Date: | 2001-07-04 15:56:55 |
Message-ID: | 996802F75C3CD411B424001083FA445B05957B@CET_PONXX_FP001 |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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(at)grafx(dot)ro]
> Sent: 04 July 2001 14:46
> To: pgsql-general(at)postgresql(dot)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.
*****************************************************************************
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2001-07-04 16:06:00 | Re: Re: lo wrappers - still working on it |
Previous Message | Fabrizio Mazzoni | 2001-07-04 15:46:41 | help with a rule... |