pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feed From: Vernon Wu <vernonw@gatewaytech.com>
To: pgsql-sql@postgresql.org, Dmitry Tkach <dmitry@openratings.com>
Subject: Re: null foreign key column
Date: Wed, 12 Feb 2003 14:35:07 -0800
Message-ID: <FEY83IG42SQA7EB94TR71LGNMVUWSUO.3e4acc1b@kimiko> (raw )
In-Reply-To: <b2ebqi$9eb$1@news.hub.org >
12/02/2003 2:24:49 PM, Dmitry Tkach <dmitry@openratings.com> wrote:
>You don't want it to be serial - just make it 'person_id in'
Any reasons?
>
>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
>> ------=_NextPart_000_0005_01C2D1EE.61998D70
>> Content-Type: text/html;
>> charset="iso-8859-1"
>> Content-Transfer-Encoding: quoted-printable
>>
>> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
>> <HTML><HEAD>
>> <META http-equiv=3DContent-Type content=3D"text/html; charset=3Diso-8859-1">
>> <META content=3D"MSHTML 6.00.2800.1106" name=3DGENERATOR>
>> <STYLE></STYLE>
>> </HEAD>
>> <BODY bgColor=3D#ffffff>
>> <DIV><FONT face=3DArial size=3D2>Hi all,</FONT></DIV>
>> <DIV><FONT face=3DArial size=3D2></FONT> </DIV>
>> <DIV><FONT face=3DArial size=3D2>I would like to have a foreign key column =
>> in my=20
>> table which allows null value also.</FONT></DIV>
>> <DIV><FONT face=3DArial size=3D2>But the below create table sql command doe=
>> sn't=20
>> accept null value for person_id.</FONT></DIV>
>> <DIV><FONT face=3DArial size=3D2>How to do in postgres?</FONT></DIV>
>> <DIV><FONT face=3DArial size=3D2></FONT><FONT face=3DArial size=3D2></FONT>=
>> </DIV>
>> <DIV><FONT face=3DArial size=3D2>create table event<BR>(<BR> &nb=
>> sp;=20
>> event_id &=
>> nbsp; =20
>> serial &nb=
>> sp; =20
>> not null,<BR> event_description &n=
>> bsp;=20
>> char(255) =
>> =20
>> ,<BR> =20
>> person_id =
>> =20
>> serial &nb=
>> sp; =20
>> ,<BR> primary key (event_id),<BR> forei=
>> gn=20
>> key (person_id)<BR> references pe=
>> rson=20
>> (person_id)<BR>);</FONT></DIV>
>> <DIV><FONT face=3DArial size=3D2></FONT> </DIV>
>> <DIV><FONT face=3DArial size=3D2>regards</FONT></DIV>
>> <DIV><FONT face=3DArial size=3D2>Jai</FONT></DIV></BODY></HTML>
>>
>> ------=_NextPart_000_0005_01C2D1EE.61998D70--
>>
>
>
>---------------------------(end of broadcast)---------------------------
>TIP 2: you can get off all lists at once with the unregister command
> (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)
>
view thread (6+ messages) latest in thread
Message-ID: <FEY83IG42SQA7EB94TR71LGNMVUWSUO.3e4acc1b@kimiko>
Permalink: ../FEY83IG42SQA7EB94TR71LGNMVUWSUO.3e4acc1b@kimiko/
Also on: postgresql.org/message-id/FEY83IG42SQA7EB94TR71LGNMVUWSUO.3e4acc1b@kimiko
copy link · copy postgr.es
reply Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-sql@postgresql.org
Cc: vernonw@gatewaytech.com, dmitry@openratings.com
Subject: Re: null foreign key column
In-Reply-To: <FEY83IG42SQA7EB94TR71LGNMVUWSUO.3e4acc1b@kimiko>
References: <b2ebqi$9eb$1@news.hub.org> <FEY83IG42SQA7EB94TR71LGNMVUWSUO.3e4acc1b@kimiko>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox