   "Compile a environments query, returning a vector containing the SQL and parameters
   for the query. All node columns are selected, and no order is applied."
   [ops query]
-  {:post [valid-jdbc-query? %]}
+  {:post [(valid-jdbc-query? %)]}
   (let [{:keys [where params]} (when query (compile-term ops query))
         projection (format "SELECT %s FROM environments " (column-map->sql environments-columns))
         where-clause (when where

  "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? %]}
  (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 fact query, returning a vector containing the SQL and parameters
  for the query. All fact columns are selected, and no order is applied."
  [ops query]
  {:post [(valid-jdbc-query? %)]}
  (let [{:keys [where params]} (compile-term ops query)
        sql (format "SELECT %s FROM (select cf.certname, cf.name, cf.value, env.name as environment
                                     FROM certname_facts cf INNER JOIN certname_facts_metadata cfm on cf.certname = cfm.certname
