Merge pull request #21169 from sixcorners/master

Don't leak so many connections in the pg backend
This commit is contained in:
James Bardin 2019-05-05 09:40:59 -04:00 committed by GitHub
commit 325344beaf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 3 deletions

View File

@ -65,7 +65,7 @@ func (b *Backend) configure(ctx context.Context) error {
// Prepare database schema, tables, & indexes.
var query string
query = `CREATE SCHEMA IF NOT EXISTS %s`
if _, err := db.Query(fmt.Sprintf(query, b.schemaName)); err != nil {
if _, err := db.Exec(fmt.Sprintf(query, b.schemaName)); err != nil {
return err
}
query = `CREATE TABLE IF NOT EXISTS %s.%s (
@ -73,11 +73,11 @@ func (b *Backend) configure(ctx context.Context) error {
name TEXT,
data TEXT
)`
if _, err := db.Query(fmt.Sprintf(query, b.schemaName, statesTableName)); err != nil {
if _, err := db.Exec(fmt.Sprintf(query, b.schemaName, statesTableName)); err != nil {
return err
}
query = `CREATE UNIQUE INDEX IF NOT EXISTS %s ON %s.%s (name)`
if _, err := db.Query(fmt.Sprintf(query, statesIndexName, b.schemaName, statesTableName)); err != nil {
if _, err := db.Exec(fmt.Sprintf(query, statesIndexName, b.schemaName, statesTableName)); err != nil {
return err
}