From: Wei Weng <wweng@kencast.com>
To: Vernon Wu <vernonw@gatewaytech.com>
Cc: pgsql-sql@postgresql.org, Dmitry Tkach <dmitry@openratings.com>
Subject: Re: null foreign key column
Date: Wed, 12 Feb 2003 18:03:56 -0500 (EST)
Message-ID: <Pine.LNX.4.44.0302121802350.14220-100000@localhost.localdomain> (raw)
In-Reply-To: <FEY83IG42SQA7EB94TR71LGNMVUWSUO.3e4acc1b@kimiko>
On Wed, 12 Feb 2003, Vernon Wu wrote:
>
> 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?
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
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: wweng@kencast.com, vernonw@gatewaytech.com, dmitry@openratings.com
Subject: Re: null foreign key column
In-Reply-To: <Pine.LNX.4.44.0302121802350.14220-100000@localhost.localdomain>
References: <FEY83IG42SQA7EB94TR71LGNMVUWSUO.3e4acc1b@kimiko> <Pine.LNX.4.44.0302121802350.14220-100000@localhost.localdomain>
* 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