   "Compile a resource query, returning a vector containing the SQL and
   parameters for the query. All resource columns are selected, and no order is applied."
   [ops query]
-  {:post [valid-jdbc-query? %]}
+  {:post [(valid-jdbc-query? %)]}
   (let [{:keys [where params]} (compile-term ops query)
         sql (format "SELECT %s
                        FROM (SELECT c.hash as catalog, e.name as environment, catalog_id, resource,

  "Compile a node query, returning a vector containing the SQL and parameters
  for the query. All node columns are selected, and no order is applied."
  [version ops query]
  {:post [valid-jdbc-query? %]}
  (let [sql (format "SELECT %s FROM (SELECT
                     reports.hash,
                     reports.certname,

  "Compile a node query, returning a vector containing the SQL and parameters
  for the query. All node columns are selected, and no order is applied."
  [version ops query]
  {:post [(valid-jdbc-query? %)]}
  (let [sql (case version
              (:v1 :v2 :v3)
              (format "SELECT %s FROM certnames"
