check postgres version and use most appropriate syntax for querying json field