Re: [pgsql-es-ayuda] Problemas con llaves foráneas

From: Lennin Caro <lennin(dot)caro(at)yahoo(dot)com>
To: pgsql-es-ayuda(at)postgresql(dot)org, Reynier Perez Mira <rperezm(at)uci(dot)cu>
Subject: Re: [pgsql-es-ayuda] Problemas con llaves foráneas
Date: 2008-10-13 19:15:50
Message-ID: 979525.12847.qm@web59509.mail.ac4.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-es-ayuda

--- On Mon, 10/13/08, Reynier Perez Mira <rperezm(at)uci(dot)cu> wrote:

> From: Reynier Perez Mira <rperezm(at)uci(dot)cu>
> Subject: [pgsql-es-ayuda] Problemas con llaves foráneas
> To: pgsql-es-ayuda(at)postgresql(dot)org
> Date: Monday, October 13, 2008, 3:22 PM
> Buenos días listeros:
> Tengo dos tablas en una BD cuyo código SQL es el
> siguiente:
>
> modlic_licencias:
> ---------------------------
> CREATE TABLE public.modlic_licencias (
> id_licencia bigint NOT NULL,
> id_categoria bigint NOT NULL,
> id_autor bigint NOT NULL,
> nombre varchar(50),
> nodvd integer NOT NULL,
> fecha_creacion date,
> version varchar(10),
> documentacion text,
> sitio varchar(150),
> fecha_vencimiento date,
> privativo boolean NOT NULL DEFAULT true,
> CONSTRAINT licencia_software_pkey
> PRIMARY KEY (id_licencia),
> CONSTRAINT fk_lic_licidio
> FOREIGN KEY (id_licencia)
> REFERENCES public.modlicrel_licidio(id_licencia)
> ON DELETE CASCADE
> ON UPDATE CASCADE
> ) WITH (
> OIDS = FALSE
> );
>
> modlic_categorias:
> ---------------------------
> CREATE TABLE public.modlic_categorias (
> id_categoria integer NOT NULL,
> titulo_categoria varchar(150) NOT NULL,
> activa boolean NOT NULL DEFAULT false,
> CONSTRAINT modlic_categorias_pkey
> PRIMARY KEY (id_categoria)
> ) WITH (
> OIDS = FALSE
> );
>
> Ahora bien. Una categoría puede tener 0 o muchas licencias
> lo cual crearía una relación 0 ... n de la tabla
> categorías a la tabla licencias. Cuando intento crear la
> relación Postgre me arroja este error:
>
> SQL Error: ERROR: there is no unique constraint matching
> given keys for referenced table "modlic_licencias"
>
> ¿Alguien me podría decir que es lo que estoy haciendo
> mal?
>
> Un saludo y gracias por adelantado
> Ing. Reynier Pérez Mira
> Grupo de Soporte al Desarrollo - Dirección Técnica IP
>

No veo la estructura de la tabla public.modlicrel_licidio

In response to

Responses

Browse pgsql-es-ayuda by date

  From Date Subject
Next Message Jaime Casanova 2008-10-13 19:19:23 Re: RE: [pgsql-es-ayuda] Problemas con llaves foráneas
Previous Message Reynier Perez Mira 2008-10-13 18:52:36 RE: [pgsql-es-ayuda] Problemas con llaves foráneas