Postgresql giving error with empty array : a.id IN () doesn't work with Postgresql