Adding a new version of the check_postgresql script due to changes in the way pg_stat handles query activity. The new version is not backwards compatible, and replaces check_query column with state and query columns.
This version is for PostgreSQL 9.2 and newer.