Re: there is no unique constraint matching given keys for referenced table

From: Jaime Casanova <systemguards(at)gmail(dot)com>
To: Víctor Pérez Juárez <victor(dot)perez(at)e-evolution(dot)com>
Cc: pgsql-es-ayuda(at)postgresql(dot)org
Subject: Re: there is no unique constraint matching given keys for referenced table
Date: 2005-11-17 19:25:41
Message-ID: c2d9e70e0511171125o5285e828r3f4b77bca4ab54ca@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-es-ayuda

On 11/17/05, Víctor Pérez Juárez <victor(dot)perez(at)e-evolution(dot)com> wrote:
> Hola Lista!
>
> alguien sabe como resolver este error que me envia PostgreSQL.
>

Deberias haber explicado primero que estas ejecutando varias
sentencias en un script probablemente, o que sacastes esto del log...
(cual de las dos por cierto?)

> ERROR: there is no unique constraint matching given keys for referenced
> table "ad_system"
> ERROR: relation "ad_system" does not exist
>

esto es porque estas intentando crear un FK que apunta a una tabla en
la que no hay clave primaria o le estas indicando una columna de la
tabla que no tiene clave primaria.

ALTER TABLE tablita ADD CONSTRAINT nombre_fk
FOREING KEY (columnadetablita)
REFERENCES tabla_referencial(columna_referencial);

En este caso debe haber un indice unico creado sobre
tabla_referencial(columna_referencial).

> NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index
> "ad_system_pkey" for table "ad_system"
>

Esto no es parte del error es un mensaje de un create table
indicandote que creo un indice unico para implementar el constraint
PRIMARY KEY.

> Saludos
> Victor
> www.e-evolution.com
>
>

--
Atentamente,
Jaime Casanova
(DBA: DataBase Aniquilator ;)

In response to

Browse pgsql-es-ayuda by date

  From Date Subject
Next Message Jaime Casanova 2005-11-17 19:29:05 Re: there is no unique constraint matching given keys for referenced table
Previous Message Víctor Pérez Juárez 2005-11-17 19:17:05 there is no unique constraint matching given keys for referenced table