fix the "operator does not exist: boolean = integer" error

This error happens when using the postgres backend