lets consider simple table
addresses_tab
id (SERIAL), user_id (INTEGER) address (VARCHAR)
It is possible to generate unique index on two columns:
user_id, address
but only in case if field address IS NOT NULL
So valid case is:
15, 'SOME STREET'
15, NULL
15, 'ANOTHER STREET'
15, NULL
but invalid is
15, 'SOME STREET'
15, 'SOME STREET'