fix adding duplicate PK attributes in select query

If there's a subquery and options.attributes is defined and contains PK field duplicate would be added.