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 95EA69FA2C3 for ; Sat, 6 May 2006 15:43:55 -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 20279-08 for ; Sat, 6 May 2006 15:43:51 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from ug-out-1314.google.com (ug-out-1314.google.com [66.249.92.175]) by postgresql.org (Postfix) with ESMTP id 05FCA9F9C9E for ; Sat, 6 May 2006 15:43:50 -0300 (ADT) Received: by ug-out-1314.google.com with SMTP id m3so1224713ugc for ; Sat, 06 May 2006 11:43:48 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:references; b=RA/Q1z9eLj74M5Vzn3YvKd4sf5FiSfTFTe5cvLU0vntDjt7ukHTyqQOvzTGLq7haYciN84jxbX1OZVkQJUSfkeXZ2SC5I0DHrFm/YUBRJfv/f6or2ZElK9fJCATfhal9zskQ8AtMyl0Ov6ivG6sBpPbPoX0OIJucM27zeuKoegQ= Received: by 10.78.57.11 with SMTP id f11mr271479hua; Sat, 06 May 2006 11:43:48 -0700 (PDT) Received: by 10.78.45.17 with HTTP; Sat, 6 May 2006 11:43:48 -0700 (PDT) Message-ID: Date: Sat, 6 May 2006 13:43:48 -0500 From: "kernel.alert kernel.alert" To: pgsql-sql@postgresql.org Subject: Re: problem with uniques and foreing keys In-Reply-To: MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_15322_24313888.1146941028415" References: X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200605/69 X-Sequence-Number: 25100 ------=_Part_15322_24313888.1146941028415 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Sorry i had a mistake in the post it was with the definition of the primary key in the empresa table... I'm having the same error when i build the last table... thanks for your answers... 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), > primary key(id_empresa) ); > 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 ... > > Krackem > > > ------=_Part_15322_24313888.1146941028415 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline
Sorry i had a mistake in the post it was with the definition of t= he primary key in the empresa table...

I'm having the same error whe= n i build the last table...


thanks for your answers...
 =

Hi list...

Please i have a problem with this...
I create the follow tables...

--------------------------------------= ------------------

CREATE TABLE empresa (
  id_empresa =         integer  NOT NULL primary k= ey,
  nombre         &nbs= p;   varchar(45),

     = primary key(id_empresa)

);
CREATE TABLE casino (
  id_cas= ino          integer  NOT= NULL,
  id_empresa        = integer      REFERENCES empresa(id_empresa),
<= br>  nombre          = ;   varchar(45),

  primary key(id_casino,id_empresa)
);
CREATE TABLE maq_= casino (
  id_empresa      integer  N= OT 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)<= br>);

--------------------------------------------------------
When i'm gonna to create the last table i got this error:

 

ERROR:  no h= ay restriccion unique que coincida con las columnas dadas en la tabla refer= ida <<casino>>

That in english is like .. there is no a unique constraint with col= umns referred  in casino table.


Please where is the problem...

Greetings ...

Krac= kem



------=_Part_15322_24313888.1146941028415--