X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id 79AA49F9C9E for ; Sat, 6 May 2006 14:47:39 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 05303-02 for ; Sat, 6 May 2006 14:47:28 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from rhino.esc1.com (dpc67142225134.direcpc.com [67.142.225.134]) by postgresql.org (Postfix) with ESMTP id 268219FA2C3 for ; Sat, 6 May 2006 14:47:23 -0300 (ADT) Received: from rhino.esc1.com (localhost.localdomain [127.0.0.1]) by rhino.esc1.com (8.12.11/8.12.11) with ESMTP id k46HkoxE018011 for ; Sat, 6 May 2006 13:46:52 -0400 Received: from localhost (localhost [[UNIX: localhost]]) by rhino.esc1.com (8.12.11/8.12.11/Submit) id k46HknCj018009 for pgsql-sql@postgresql.org; Sat, 6 May 2006 13:46:49 -0400 From: Terry Lee Tucker Organization: Enhanced Solutions Computing To: pgsql-sql@postgresql.org Subject: Re: problem with uniques and foreing keys Date: Sat, 6 May 2006 13:46:47 -0400 User-Agent: KMail/1.5.3 References: In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200605061346.47025.terry@esc1.com> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200605/67 X-Sequence-Number: 25098 On Saturday 06 May 2006 01:27 pm, "kernel.alert kernel.alert" 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 en la --> tabla referida <> --> --> 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, ^^^^^^^