protected function query_all_assoc ( $sql )
    {
        $sql = $this->sql_printf(func_get_args());
        if (!($res = pg_query($this->conn, $sql)))
        {
            $this->sql_errcheck($sql);
        }
        $rs = array();
        while ($row  = pg_fetch_assoc($res))
        {
            $rs[] = $row;
        }
        pg_free_result($res);
        return $rs;
    }