.. efun:: int pg_query (string query) int pg_query (string query, int flags) :include: :optional: Queue a new query :arg:`query` to the database connection on the current object. Return the unique id of the query. The query result itself will be passed as argument to the callback function. :arg:`flags` can be one of these values: - :macro:`PG_RESULT_ARRAY`: Pass the query result as array. - :macro:`PG_RESULT_MAP`: Pass the query result as mapping. The function is available only if the driver is compiled with PostgreSQL support. In that case, :macro:`__PGSQL__` is defined. .. todo:: should notes like the above be arguments to the optional flag? i.e., ``:optional: available if the driver is compiled with PostgreSQL support (in which case :macro:`__PGSQL__` is defined).``? The efun triggers a privilege violation ("pgsql", "pg_query"). :history 3.3.445 introduced: :history 3.3.640 changed: added the privilege violation. .. seealso:: :concept:`pgsql`, :efun:`pg_connect`, :efun:`pg_conv_string`, :efun:`pg_pending`, :efun:`pg_close`, :master:`privilege_violation`