Received: from mail7 (mail7.rambler.ru [217.73.192.76]) by postgresql.org (8.11.3/8.11.4) with SMTP id f95INXn94406 for ; Fri, 5 Oct 2001 14:23:33 -0400 (EDT) (envelope-from xmm@rambler.ru) Received: from 217.73.192.35 by rambler.ru with SMTP id AA24818 for pgsql-general@postgresql.org; Fri, 5 Oct 2001 00:02:04 +0400 (MSD) From: Marat Khairullin To: pgsql-sql@postgresql.org Cc: pgsql-general@postgresql.org Subject: Why the weak key is created as unique Message-Id: <3BBCCE6C.AA21835@mb2.rambler.ru> Content-Type: text/plain; charset=koi8-r MIME-Version: 1.0 Date: Fri, 5 Oct 2001 00:02:36 +0300 (MSK) X-Archive-Number: 200110/126 X-Sequence-Number: 15944 Example: 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@rambler.ru Marat.Khairullin@f92.n5049.z2.fidonet.org ---- Бесплатная почта http://mail.Rambler.ru/ Рамблер-Покупки http://ad.rambler.ru/ban.clk?pg=1691&bn=9346