From: | Marat Khairullin <xmm(at)rambler(dot)ru> |
---|---|
To: | pgsql-sql(at)postgresql(dot)org |
Subject: | Why the weak key is created as unique |
Date: | 2001-10-04 15:08:29 |
Message-ID: | 3BBC7B6D.AA21835@mb2.rambler.ru |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
mydb=> create table AAA (a serial primary key);
NOTICE: CREATE TABLE will create implicit sequence 'aaa_a_seq' for SERIAL column 'aaa.a'
NOTICE: CREATE TABLE/PRIMARY KEY will create implicit index 'aaa_pkey' for table 'aaa'
CREATE
mydb=> create table BBB (a serial references AAA, b integer, primary key(a,b));
NOTICE: CREATE TABLE will create implicit sequence 'bbb_a_seq' for SERIAL column 'bbb.a'
NOTICE: CREATE TABLE/PRIMARY KEY will create implicit index 'bbb_pkey' for table 'bbb'
NOTICE: CREATE TABLE/UNIQUE will create implicit index 'bbb_a_key' for table 'bbb'
NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s)
CREATE
mydb=> insert into AAA values (1);
INSERT 20369 1
mydb=> insert into BBB values (1,1);
INSERT 20370 1
mydb=> insert into BBB values (1,2);
ERROR: Cannot insert a duplicate key into unique index bbb_a_key
I would like that the pair keys (a,b) was unique.
Certainly, I can remove unique index 'bbb_a_key'...
But how more correctly?
--
Marat Khairullin mailto:xmm(at)rambler(dot)ru
Marat(dot)Khairullin(at)f92(dot)n5049(dot)z2(dot)fidonet(dot)org
----
Бесплатная почта http://mail.Rambler.ru/
Рамблер-Покупки http://ad.rambler.ru/ban.clk?pg=1691&bn=9346
From | Date | Subject | |
---|---|---|---|
Next Message | Tomasz Myrta | 2001-10-04 15:51:48 | temporary views |
Previous Message | Josh Berkus | 2001-10-04 15:02:00 | Re: SQL Syntax / Logic question |