Thread: Error Message: ERROR: UNIQUE constraint matching given keys for referenced table "item" not found

----------------------------------------- (on mailserver)

email-body was scanned and no virus found.   From MIS -  Network Administrator
---------------------------------------------------------
-- System Information --

Platform:         Windows XP
Version:         5.1
Build:         2600 Service Pack 1

-- Application Information --

Name:         pgAdmin II
Version:         1.6.0
Descripton:

Name:         pgSchema
Version:         1.6.0
Descripton:     PostgreSQL Schema Objects v1.6.0

-- Database Information --

Version:         7.3.2
Descripton:     PostgreSQL 7.3.2 on i386-redhat-linux-gnu, compiled by GCC
i386-redhat-linux-gcc (GCC) 3.2.2 20030213 (Red Hat Linux 8.0 3.2.2-1)

-- Driver Information --

Name:         PostgreSQL
Version:         7.3.100
Descripton:     PostgreSQL 7.3.2 on i386-redhat-linux-gnu, compiled by GCC
i386-redhat-linux-gcc (GCC) 3.2.2 20030213 (Red Hat Linux

-- Error Information --

Description:     ERROR:  UNIQUE constraint matching given keys for referenced
table "item" not found
Number:         -2147467259
Routine:         pgAdmin II:frmTable.cmdOK_Click

************************************************************

Insert your comment:
Im having trouble creating foreign key for this table (itemsupp) both have
itemcode column but when I created this error occur telling UNIQUE contraint
matching. What shall I do?

Dear Robert.

I thinks that you must specify UNIQUE or PRIMARY KEY in "column of item" 
so that it should refer to it in the constraint "column of item".

Regards,
Hiroshi Saito

From: "Robert T. Meneses" <rtmeneses@7-eleven.com.ph>
(snip)

> -- Error Information --
>
> Description: ERROR:  UNIQUE constraint matching given keys for referenced
> table "item" not found
> Number: -2147467259
> Routine: pgAdmin II:frmTable.cmdOK_Click
>
> Insert your comment:
> Im having trouble creating foreign key for this table (itemsupp) both have
> itemcode column but when I created this error occur telling UNIQUE contraint
> matching. What shall I do?


It's rumoured that Robert T. Meneses once said:
> Im having trouble creating foreign key for this
> table (itemsupp) both have itemcode column but
> when I created this error occur telling UNIQUE
> contraint matching. What shall I do?

Hi,

It seems that PostgreSQL wants to have a Unique constraint  on the
referenced columns. Can you try something like
ALTER TABLE ref_table ADD CONSTRAINT ref_key UNIQUE (ref_col1, ref_col2);

to add a unique contsraint?

Regards, Dave