Fix postgresql failures related to Data type

Postgresql is kind of sensitive about different kind of data in a query, so it
was failing in cases like lookin for an ip using a filter which wasn't a valid
ip or ids values greater than the id type on the table.

This patch fix this behavior to fixed ips and floating ips.

Fixes bug 1182754

Change-Id: I83d532c28c9aec690e8e1ffad8b58e71d619d728
Merge "Fix postgresql failures related to Data type"