в posygresql этот запрос выглядит так: *select * from (select * from users where asd = 2 UNION select * from users where type = 'ddd') as users where id = 1;*
(select * from "users" where "users"."asd" = ? and "users"."asd" is not null and "type" = ? and "id" = ?) union (select * from "users" where "type" = ?)