X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id 6C8E530F624 for ; Mon, 23 Jun 2003 19:09:02 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 33891-03 for ; Mon, 23 Jun 2003 16:08:52 -0300 (ADT) Received: from saphir (dsl-082-082-095-106.arcor-ip.net [82.82.95.106]) by svr1.postgresql.org (Postfix) with ESMTP id 5D90830F626 for ; Mon, 23 Jun 2003 16:08:50 -0300 (ADT) Received: by saphir (Postfix, from userid 1000) id 071DC13105E; Mon, 23 Jun 2003 21:08:38 +0200 (CEST) Subject: Re: multi-table unique index From: Markus Bertheau To: Michael A Nachbaur Cc: PGSQL-SQL In-Reply-To: <200306231134.11430.mike@nachbaur.com> References: <1056376700.2037.2.camel@fluor> <200306231032.56257.mike@nachbaur.com> <1056392214.3405.0.camel@saphir> <200306231134.11430.mike@nachbaur.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Message-Id: <1056395317.2537.3.camel@saphir> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.0 Date: 23 Jun 2003 21:08:37 +0200 X-Archive-Number: 200306/273 X-Sequence-Number: 14031 =D0=92 =D0=9F=D0=BD=D0=B4, 23.06.2003, =D0=B2 20:34, Michael A Nachbaur =D0= =BF=D0=B8=D1=88=D0=B5=D1=82: > On Monday 23 June 2003 11:16 am, Markus Bertheau wrote: > > =D0=92 =D0=9F=D0=BD=D0=B4, 23.06.2003, =D0=B2 19:32, Michael A Nachbaur= =D0=BF=D0=B8=D1=88=D0=B5=D1=82: > > > Instead of using the "serial" datatype, you can set it to "int4 PRIMA= RY > > > KEY DEFAULT nextval(foo_type_id_seq)" and you can manually create the > > > sequence "foo_type_id_seq". > > > > > > This way all the tables share the same sequence. > > > > Yeah, but I want to force this behaviour. so that it cannot happen by > > accident when you insert records without relying on the sequence. > If you want to ensure that a value is unique when a record is inserted, e= ven=20 > if the user explicitly specifies an ID values, you can create a unique=20 > trigger on the tables, but this depends on what you want to do. I believe what you described is what I want to do. What's a unique trigger, though? --=20 Markus Bertheau. Berlin, Berlin. Germany.