Fix query for certain postgresql versions.

Created by  Rob Vermaas  on April 22, 2012
YISCM3G35J5KHV6CQHX5GWH65W4J4BBWWNLXCGTYU6ZBQITNQ7AAC
Change contents