Re: 7.1.2 ERROR: UNIQUE constraint matching given keys for referenced table ......

From: "Lincy" <Lincy(dot)Lin(at)LinuxInBox(dot)Com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: 7.1.2 ERROR: UNIQUE constraint matching given keys for referenced table ......
Date: 2001-06-26 09:59:40
Message-ID: 9hagpm$8k6$1@news.tht.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Ljb :

Thanks your help. Look like add the UNIQUE constraint on it can solve
this problem. Now I know what the problem is. But since our system must
handle multi-company in same time. So we can't let department to be UNIQUE.
What we try to using references in EmployeeInfo are just for check the
department was exist or not. So, we will try to using trigger to do this
check. Well, if need to write our own trigger for each table, we have lots
work to do. :(

Do you know the trigger can apply in inherit table ? If so, then we can
using OOP to resolve this problem (well, reduce our work.) :Q

Many thanks.

"ljb" <lbayuk(at)mindspring(dot)com> wrote in message
news:9h8nk4$2uf3$1(at)news(dot)tht(dot)net(dot)(dot)(dot)
> Lincy(dot)Lin(at)LinuxInBox(dot)Com wrote:
> >HI !
> >
> > Does anyone know what's my problem and how to resolve it ? Thanks.
> >...
> >> Create Table DepartmentInfo
> >> (
> >>...
> >> Department Char(40) Default ''
> >> );
> >>...
> >> Create Table EmployeeInfo
> >> (
> >>...
> >> Department Char(40) References
> >> DepartmentInfo (Department)
> >>...
> >> ERROR: UNIQUE constraint matching given keys for referenced
table
> >> "departmentinfo" not found
>
> Make DepartmentInfo.Department a primary key. If not possible, make a
> unique constraint on it. If it isn't unique, you shouldn't be referencing
> it as a foreign key from EmployeeInfo.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Paul Tomblin 2001-06-26 11:47:37 Re: Red Hat to support PostgreSQL
Previous Message Richard Huxton 2001-06-26 09:08:31 Re: Stored procedures?