From 2e828383e0191df94da3a18d19a9062d739c1f7a Mon Sep 17 00:00:00 2001 From: Sean Chittenden Date: Sun, 3 Jul 2016 16:20:27 -0700 Subject: [PATCH] Move the parameter down to where the statement is executed. --- builtin/logical/postgresql/backend_test.go | 5 ++--- builtin/logical/postgresql/secret_creds.go | 4 ++-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/builtin/logical/postgresql/backend_test.go b/builtin/logical/postgresql/backend_test.go index f622a4d51..3e90eb1d9 100644 --- a/builtin/logical/postgresql/backend_test.go +++ b/builtin/logical/postgresql/backend_test.go @@ -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 } diff --git a/builtin/logical/postgresql/secret_creds.go b/builtin/logical/postgresql/secret_creds.go index 11acb27ae..5d127aca6 100644 --- a/builtin/logical/postgresql/secret_creds.go +++ b/builtin/logical/postgresql/secret_creds.go @@ -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 }