Fix isuniquevalue with pk not internalid

Note: Previous version did not handle joined tables - nor does this version.