EXISTS clause in SQL
select id from user_input
union all
select id from main_set where not exists(select * from user_input);


--edit based on your comment

select *
from main_set
where id in(select id from user_input) or not exists(select * from user_input)


or, seeing as you mention performance, perhaps you should try a join as an alternative:

select main_set.*
from main_set left outer join user_input on(user_input.id=main_set.id)
where user_input.id is not null or not exists(select * from user_input)