X-Original-To: pgsql-sql@postgresql.org Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 54889475A5C for ; Mon, 10 Feb 2003 22:55:46 -0500 (EST) Received: from mta201-rme.xtra.co.nz (mta201-rme.xtra.co.nz [210.86.15.144]) by postgresql.org (Postfix) with ESMTP id D1AE8475A4B for ; Mon, 10 Feb 2003 22:55:44 -0500 (EST) Received: from mta1-rme.xtra.co.nz ([210.86.15.143]) by mta201-rme.xtra.co.nz with ESMTP id <20030211035548.LYMU1191.mta201-rme.xtra.co.nz@mta1-rme.xtra.co.nz> for ; Tue, 11 Feb 2003 16:55:48 +1300 Received: from singlarc01 ([210.54.102.52]) by mta1-rme.xtra.co.nz with SMTP id <20030211035546.ZCVI15912.mta1-rme.xtra.co.nz@singlarc01> for ; Tue, 11 Feb 2003 16:55:46 +1300 Message-ID: <000801c2d181$6c0be360$020000c0@singlarc01> From: "Arunachalam Jaisankar" To: Subject: null foreign key column Date: Tue, 11 Feb 2003 16:55:28 +1300 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_0005_01C2D1EE.61998D70" X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1106 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200302/254 X-Sequence-Number: 11652 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 ------=_NextPart_000_0005_01C2D1EE.61998D70 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
Hi all,
 
I would like to have a foreign key column = in my=20 table which allows null value also.
But the below create table sql command doe= sn't=20 accept null value for person_id.
How to do in postgres?
=  
create table event
(
  &nb= sp;=20 event_id           &= nbsp;  =20 serial           &nb= sp;   =20 not null,
    event_description    &n= bsp;=20 char(255)           =          =20 ,
   =20 person_id           =   =20 serial           &nb= sp;           =20 ,
    primary key (event_id),
    forei= gn=20 key  (person_id)
       references pe= rson=20 (person_id)
);
 
regards
Jai
------=_NextPart_000_0005_01C2D1EE.61998D70--