Re: null foreign key column

Поиск
Список
Период
Сортировка
Искать
От
Wei Weng
Тема
Re: null foreign key column
Дата
Msg-id
Pine.LNX.4.44.0302121802350.14220-100000@localhost.localdomain
Ответ на
Список
Дерево обсуждения
null foreign key column "Arunachalam Jaisankar" <jsankar@xtra.co.nz>
Re: null foreign key column Bruno Wolff III <bruno@wolff.to>
Re: null foreign key column Dmitry Tkach <dmitry@openratings.com>
Re: null foreign key column Vernon Wu <vernonw@gatewaytech.com>
Re: null foreign key column Dmitry Tkach <dmitry@openratings.com>
Re: null foreign key column Wei Weng <wweng@kencast.com>
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


В списке pgsql-sql по дате отправления
От: Dmitry Tkach
Дата:
Сообщение: Re: null foreign key column
От: Josh Berkus
Дата:
Сообщение: Re: anal about my syntax
FAQ