Search Postgresql Archives

Re: 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]

 



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

no, you must create a partial unique index...

create unique index indice_col2 on table(col1, col2) where col2 is not null;

-- 
Atentamente,
Jaime Casanova
(DBA: DataBase Aniquilator ;)

---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend


[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