Move the parameter down to where the statement is executed.

This commit is contained in:
Sean Chittenden 2016-07-03 16:20:27 -07:00
parent 08fb1a30d4
commit 2e828383e0
No known key found for this signature in database
GPG key ID: 4EBC9DC16C2E5E16
2 changed files with 4 additions and 5 deletions

View file

@ -238,14 +238,13 @@ func testAccStepReadCreds(t *testing.T, b logical.Backend, s logical.Storage, na
}
returnedRows := func() int {
stmt, err := db.Prepare("SELECT DISTINCT schemaname FROM pg_tables WHERE has_table_privilege($1, 'information_schema.role_column_grants', 'select');",
d.Username)
stmt, err := db.Prepare("SELECT DISTINCT schemaname FROM pg_tables WHERE has_table_privilege($1, 'information_schema.role_column_grants', 'select');")
if err != nil {
return -1
}
defer stmt.Close()
rows, err := stmt.Query()
rows, err := stmt.Query(d.Username)
if err != nil {
return -1
}

View file

@ -112,13 +112,13 @@ func (b *backend) secretCredsRevoke(
// the role
// This isn't done in a transaction because even if we fail along the way,
// we want to remove as much access as possible
stmt, err := db.Prepare("SELECT DISTINCT table_schema FROM information_schema.role_column_grants WHERE grantee=$1;", username)
stmt, err := db.Prepare("SELECT DISTINCT table_schema FROM information_schema.role_column_grants WHERE grantee=$1;")
if err != nil {
return nil, err
}
defer stmt.Close()
rows, err := stmt.Query()
rows, err := stmt.Query(username)
if err != nil {
return nil, err
}