Search Postgresql Archives

Re: multiple UNIQUE indices for FK

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

 




W dniu 01.03.2016 o 20:02, Igor Neyman pisze:
[--------------------]
> 
> 
> It just occured to me: how do I make sure (e.g. force within a database) with the above structure, that a message can have *only  one* sender?
> but, allow for multiple recepients?
> 
> -R
> 
> ____________________________________________________________________________________
> 
> If I'm not too late, unique partial index:
> 
> CREATE UNIQUE INDEX unique_message_sender (message_id, person_id) WHERE relationship_type = sender;
> 

Of cource.

Apparently I'm so twisted after the numerous rewrites of my schema for
this project, that I forget the obvious.


Thenx,

-R


-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general



[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