La consulta fallo: ERROR: invalid input syntax for integer: ""
LINE 1: ...m avisos where id_categoria=c.id and id_departamento='' )>0
^--->SELECT * FROM categorias c WHERE id_departamento='1' AND (select count(1) from avisos where id_categoria=c.id and id_departamento='' )>0