Neither column can be NULL if the column is part of the combination of primary key columns?

From: Emi Lu <emilu(at)cs(dot)concordia(dot)ca>
To: pgsql-general(at)postgresql(dot)org
Subject: Neither column can be NULL if the column is part of the combination of primary key columns?
Date: 2005-09-16 17:44:21
Message-ID: 432B0475.90703@cs.concordia.ca
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Greetings,

A question about "combination of several columns " as primary key .

A table test (
col1 timestamp not null default now(),
col2 timestamp,
primary key (col1, col2)
);

If I setup primary key as the *combination* of (col1, col2), the col2
will be setup as "NOT NULL" automatically right?
(Although, I did not specify not null constraint for col2)

To allow *col2* to be NULL and make record combination (col1, col2)
unique, I should setup
unique (col1, col2) ?

Thanks,
Emi

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Russ Brown 2005-09-16 17:51:35 Re: Replication
Previous Message Bill Moseley 2005-09-16 17:18:19 Re: Question about a query plan