From: Stephan Szabo <sszabo@megazone.bigpanda.com>
To: kernel.alert kernel.alert <kernel.alert@gmail.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: problem with uniques and foreing keys
Date: Sat, 6 May 2006 11:57:39 -0700 (PDT)
Message-ID: <20060506115248.G47923@megazone.bigpanda.com> (raw)
In-Reply-To: <e24c449c0605061027t5d8c06aeoe271580c5244922f@mail.gmail.com>
References: <e24c449c0605061027t5d8c06aeoe271580c5244922f@mail.gmail.com>
On Sat, 6 May 2006, kernel.alert kernel.alert wrote:
> 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),
You probably want a table level constraint like:
foreign key (id_casino, id_empresa) references casino(id_casino,
id_empresa)
That's not the same as two single-column constraints which is what you
have above.
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: sszabo@megazone.bigpanda.com, kernel.alert@gmail.com
Subject: Re: problem with uniques and foreing keys
In-Reply-To: <20060506115248.G47923@megazone.bigpanda.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox