Re: problem with uniques and foreing keys - Mailing list pgsql-sql

From Terry Lee Tucker
Subject Re: problem with uniques and foreing keys
Date
Msg-id 200605061346.47025.terry@esc1.com
Whole thread Raw
In response to problem with uniques and foreing keys  ("kernel.alert kernel.alert" <kernel.alert@gmail.com>)
List pgsql-sql
On Saturday 06 May 2006 01:27 pm, "kernel.alert kernel.alert" 
<kernel.alert@gmail.com> thus communicated:
--> Hi list...
-->
--> Please i have a problem with this...
-->
--> I create the follow tables...
-->
--> --------------------------------------------------------
-->
--> CREATE TABLE empresa (
-->   id_empresa         integer  NOT NULL primary key,
-->   nombre             varchar(45),
--> );
--> CREATE TABLE casino (
-->   id_casino          integer  NOT NULL,
-->   id_empresa         integer      REFERENCES empresa(id_empresa),
-->
-->   nombre             varchar(45),
-->
-->   primary key(id_casino,id_empresa)
--> );
--> CREATE TABLE maq_casino (
-->   id_empresa      integer  NOT NULL REFERENCES  casino(id_empresa),
-->   id_casino       integer  NOT NULL REFERENCES  casino(id_casino),
-->
-->   ubicacion_sala     varchar(45) default NULL,
-->   primary key(id_empresa,id_casino,id_tipo_maquina,id_maq_casino)
--> );
-->
--> --------------------------------------------------------
-->
--> When i'm gonna to create the last table i got this error:
-->
--> ERROR:  no hay restriccion unique que coincida con las columnas dadas enla --> tabla referida <<casino>>
-->
--> That in english is like .. there is no a unique constraint with columns
--> referred  in casino table.
-->
-->
--> Please where is the problem...
-->
--> Greetings ...
-->
-->
-->

-- 
The columns referenced in the maq_casino table must have UNIQUE constraints
on them in their table definition as in:
id_casino          integer  UNIQUE NOT NULL,                                         ^^^^^^^


pgsql-sql by date:

Previous
From: "kernel.alert kernel.alert"
Date:
Subject: problem with uniques and foreing keys
Next
From: Bruno Wolff III
Date:
Subject: Re: problem with uniques and foreing keys