Re: null foreign key column

Поиск
Список
Период
Сортировка
От Wei Weng
Тема Re: null foreign key column
Дата
Msg-id Pine.LNX.4.44.0302121802350.14220-100000@localhost.localdomain
обсуждение исходный текст
Ответ на Re: null foreign key column  (Vernon Wu <vernonw@gatewaytech.com>)
Список pgsql-sql
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



В списке pgsql-sql по дате отправления:

Предыдущее
От: Dmitry Tkach
Дата:
Сообщение: Re: null foreign key column
Следующее
От: Josh Berkus
Дата:
Сообщение: Re: anal about my syntax