TBH it's a bit more verbose and less performant than need be, but hey, if it works, rock on! But don't use 'select *' in production code.
Consider next time something like
if exists (select from sometable t1
join sometable t2 on
t1.resource_id = t2.resource_id
and t1.res_id <> t2.res_id
and tstzrange(t1.start, t1.end) && tstzrange(t2.start, t2.end)
where t1.res_id = new.res_id )
then
... raise exception
I had to solve this recently, where the actual start/end times were stored on a related table. I'm no SQL wizard, but I'd love to share my solution in case it helps others (it might be terrible).
Note: I changed the actual tables/domain to be generic, this is a poor example and it made more sense for my usecase, but this shows general approach.