Search Postgresql Archives

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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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





---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
      subscribe-nomail command to majordomo@xxxxxxxxxxxxxx so that your
      message can get through to the mailing list cleanly

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux