select contractid from tcim_s_enterprice EXCEPT select contractid from dblink ( 'host=172.16.51.25 port=5432 dbname=contract user=eshop password=iTLxUQ7FUv1sBu', 'select contractid from tcrm_s_contractmaster ' ) AS B ( contractid CHARACTER VARYING (100) )