Skip to content

Commit 2fb7bde

Browse files
authored
Merge pull request #511 from nais/fix_specialchars_in_username
fix string handling in statement
2 parents 52ef68f + 2db68fd commit 2fb7bde

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

pkg/postgres/audit.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ func enableAuditAsAppUser(ctx context.Context, appName, namespace, cluster strin
3636

3737
defer db.Close()
3838

39-
enableAudit := fmt.Sprintf(`CREATE EXTENSION IF NOT EXISTS pgaudit; ALTER USER %s IN DATABASE %s SET pgaudit.log TO 'none';`, connectionInfo.username, connectionInfo.dbName)
39+
enableAudit := fmt.Sprintf(`CREATE EXTENSION IF NOT EXISTS pgaudit; ALTER USER "%s" IN DATABASE "%s" SET pgaudit.log TO 'none';`, connectionInfo.username, connectionInfo.dbName)
4040
_, err = db.ExecContext(ctx, enableAudit)
4141
if err != nil {
4242
return fmt.Errorf("enableAuditAsAppUser: error enabling pgaudit: %w", err)

0 commit comments

Comments
 (0)