Home create combine unique index on two tables data in postgres
Reply: 0

create combine unique index on two tables data in postgres

Praveen D
1#
Praveen D Published in 2018-01-12 18:54:46Z

I am trying to create join index on the basis of two tables data. Below two tables have one to one relation. If one record record came which has guest value true for mobile that is in contact_tbl. I created unique index on contact_tbl(customer_id, mobile and type) but I want this unique should be if guest is false in profile_tbl.

As per below example id - 4 should not be inserted.

profile_tbl  
id  guest  
1   true  
2   true  
3   false  
4   false  
contact_tbl  
id customer_id mobile type  
11   1    545454  1  
12   2    545454  1    
13   3    123541  1   
14   4    123541  1  
You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.320183 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO