X-Original-To: pgsql-sql@postgresql.org Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 87B56474E5C for ; Wed, 12 Feb 2003 18:03:40 -0500 (EST) Received: from mta4.snet.net (mta4.snet.net [204.60.203.76]) by postgresql.org (Postfix) with ESMTP id EECB3474E44 for ; Wed, 12 Feb 2003 18:03:39 -0500 (EST) Received: from pop.snet.net (pop.snet.net [204.60.203.72]) by mta4.snet.net (8.12.3/8.12.3/SNET-mx-1.2/D-1.1.1.1/O-1.1.1.1) with ESMTP id h1CN2q2I029861; Wed, 12 Feb 2003 18:02:52 -0500 (EST) X-Originating-IP: [64.252.95.167] X-SBCIS-MTA: [pop.snet.net] Received: from [192.168.1.83] (167.95.252.64.snet.net [64.252.95.167]) by pop.snet.net (8.12.3/8.12.3/SNET-pop-1.2/D-1.1.1.1/O-1.1.1.1) with ESMTP id h1CN3LTV008089; Wed, 12 Feb 2003 18:03:21 -0500 (EST) Date: Wed, 12 Feb 2003 18:03:56 -0500 (EST) From: Wei Weng X-X-Sender: wweng@localhost.localdomain To: Vernon Wu Cc: pgsql-sql@postgresql.org, Dmitry Tkach Subject: Re: null foreign key column In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200302/268 X-Sequence-Number: 11666 On Wed, 12 Feb 2003, Vernon Wu wrote: > > 12/02/2003 2:24:49 PM, Dmitry Tkach wrote: > > >You don't want it to be serial - just make it 'person_id in' > > Any reasons? serial is an auto-increment datatype. In your table, you probably want to control what person_id is, rather than letting them mindlessly auto-increment row after row, given it is a foreign key to a Person table. > > > > >I hope, it helps... > > > >Dima > > > >Arunachalam Jaisankar wrote: > >> This is a multi-part message in MIME format. > >> > >> ------=_NextPart_000_0005_01C2D1EE.61998D70 > >> Content-Type: text/plain; > >> charset="iso-8859-1" > >> Content-Transfer-Encoding: quoted-printable > >> > >> Hi all, > >> > >> I would like to have a foreign key column in my table which allows null val= > >> ue also. > >> But the below create table sql command doesn't accept null value for person= > >> _id. > >> How to do in postgres? > >> > >> create table event > >> ( > >> event_id serial not null, > >> event_description char(255) , > >> person_id serial , > >> primary key (event_id), > >> foreign key (person_id) > >> references person (person_id) > >> ); > >> > >> regards > >> Jai