Postgres drop database error: pq: cannot drop the currently open database
<p>I'm trying to drop the database I'm currently connected to like so, but I'm getting this error:</p>

<pre><code>pq: cannot drop the currently open database
</code></pre>

<p>I don't really understand how I'm expected to drop the database if I have to close my connection, because then I don't think I will be able to use dbConn.Exec to execute my DROP DATABASE statement?</p>

<pre><code>dbConn *sql.DB

func stuff() error {
  _, err := dbConn.Exec(fmt.Sprintf(`DROP DATABASE %s;`, dbName))
  if err != nil {
    return err
  }

  return dbConn.Close()
}
</code></pre>

<p>I guess I could connect to a different database and then execute it on that connection, but I'm not even sure if that'd work, and it seems really weird to have to connect to a new database just to drop a different database. Any ideas? Thanks.</p>