Search Postgresql Archives

PRIMARY KEY on a *group* of columns imply that each column is NOT NULL?

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

 



If I define a primary key:

       name TEXT NOT NULL,
       address INET,
       PRIMARY KEY(name, address) 

the definition (seen by \d) becomes:

 name          | text                        | not null
 address       | inet                        | not null

"address" is now not null, which I do not want. It seems unnecessary:
I just want the tuple (name, address) to be unique, which seems
possible even if some 'address' values are NULL.

It does not appear to be documented in
http://www.postgresql.org/docs/7.4/interactive/ddl-constraints.html#AEN1975.
Is there a workaround?


---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
    (send "unregister YourEmailAddressHere" to majordomo@xxxxxxxxxxxxxx)

[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