quastions about primary key

Поиск
Список
Период
Сортировка
Искать

quastions about primary key

От:
"jack" <datactrl@tpg.com.au>
Дата:
Is that possible to have a two columns primary key on a table with null
value on second column?

Jack


Re: quastions about primary key

От:
Tomasz Myrta <jasiek@klaster.net>
Дата:
jack wrote:
> Is that possible to have a two columns primary key on a table with null
> value on second column?
> 
> Jack
Probably not, because (1,2,null,null) is unique for postresql.
Watch discussion on mailing list
about unique indexes (on which primary key is based) several days ago.

Regards,
Tomasz Myrta


Re: quastions about primary key

От:
Stephan Szabo <sszabo@megazone23.bigpanda.com>
Дата:
On Fri, 24 Jan 2003, jack wrote:

> Is that possible to have a two columns primary key on a table with null
> value on second column?

No, because primary key implies not null on all columns involved
(technically I think it's that a non-deferrable primary key implies
not null on all columns involved, but we don't support deferrable ones)



Re: quastions about primary key

От:
"jack" <datactrl@tpg.com.au>
Дата:

I try use uique instead of primary key. And it works, it allows null values.
Is there any other difference between primary key and unique?

Jack
----- Original Message -----
From: "Stephan Szabo" 
To: "jack" 
Cc: 
Sent: Saturday, January 25, 2003 1:14 AM
Subject: Re: [SQL] quastions about primary key


> On Fri, 24 Jan 2003, jack wrote:
>
> > Is that possible to have a two columns primary key on a table with null
> > value on second column?
>
> No, because primary key implies not null on all columns involved
> (technically I think it's that a non-deferrable primary key implies
> not null on all columns involved, but we don't support deferrable ones)
>
>


Re: quastions about primary key

От:
Bruno Wolff III <bruno@wolff.to>
Дата:
On Sun, Jan 26, 2003 at 12:29:12 +1000, jack  wrote:
> 
> I try use uique instead of primary key. And it works, it allows null values.
> Is there any other difference between primary key and unique?

I believe that the primary key is the default key for foreign key references
into a table.

FAQ