From: | Wei Weng <wweng(at)kencast(dot)com> |
---|---|
To: | Vernon Wu <vernonw(at)gatewaytech(dot)com> |
Cc: | pgsql-sql(at)postgresql(dot)org, Dmitry Tkach <dmitry(at)openratings(dot)com> |
Subject: | Re: null foreign key column |
Date: | 2003-02-12 23:03:56 |
Message-ID: | Pine.LNX.4.44.0302121802350.14220-100000@localhost.localdomain |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
On Wed, 12 Feb 2003, Vernon Wu wrote:
>
> 12/02/2003 2:24:49 PM, Dmitry Tkach <dmitry(at)openratings(dot)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
From | Date | Subject | |
---|---|---|---|
Next Message | Dmitry Tkach | 2003-02-13 00:19:14 | Re: null foreign key column |
Previous Message | Dmitry Tkach | 2003-02-12 22:45:08 | Re: How do you select from a table until a condition is met? |