From e1f1c4a13b6ab154111e514aeb93c6261fb6a6d1 Mon Sep 17 00:00:00 2001 From: Felix Kunde Date: Thu, 17 Oct 2024 16:33:03 +0200 Subject: [PATCH] ok got it --- pkg/cluster/cluster.go | 6 ++++-- pkg/util/users/users.go | 5 +---- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/pkg/cluster/cluster.go b/pkg/cluster/cluster.go index d61397eff..ce9768bd2 100644 --- a/pkg/cluster/cluster.go +++ b/pkg/cluster/cluster.go @@ -1412,14 +1412,16 @@ func (c *Cluster) initPreparedDatabaseRoles() error { if err := c.initDefaultRoles(defaultRoles, preparedDbName+constants.OwnerRoleNameSuffix, preparedDbName+"_"+preparedSchemaName, - constants.DefaultSearchPath+", "+preparedSchemaName, preparedDB.SecretNamespace); err != nil { + fmt.Sprintf("%s, %q", constants.DefaultSearchPath, preparedSchemaName), + preparedDB.SecretNamespace); err != nil { return fmt.Errorf("could not initialize default roles for database schema %s: %v", preparedSchemaName, err) } if preparedSchema.DefaultUsers { if err := c.initDefaultRoles(defaultUsers, preparedDbName+constants.OwnerRoleNameSuffix, preparedDbName+"_"+preparedSchemaName, - constants.DefaultSearchPath+", "+preparedSchemaName, preparedDB.SecretNamespace); err != nil { + fmt.Sprintf("%s, %q", constants.DefaultSearchPath, preparedSchemaName), + preparedDB.SecretNamespace); err != nil { return fmt.Errorf("could not initialize default users for database schema %s: %v", preparedSchemaName, err) } } diff --git a/pkg/util/users/users.go b/pkg/util/users/users.go index 39200db25..924d8390e 100644 --- a/pkg/util/users/users.go +++ b/pkg/util/users/users.go @@ -284,9 +284,7 @@ func produceAlterRoleSetStmts(user spec.PgUser) []string { result := make([]string, 0) result = append(result, fmt.Sprintf(alterRoleResetAllSQL, user.Name)) for name, value := range user.Parameters { - stmt := fmt.Sprintf(alterRoleSetSQL, user.Name, name, quoteParameterValue(name, value)) - fmt.Println("stmt: ", stmt) - result = append(result, stmt) + result = append(result, fmt.Sprintf(alterRoleSetSQL, user.Name, name, quoteParameterValue(name, value))) } return result } @@ -316,7 +314,6 @@ func revokeRole(groupRole, role string, db *sql.DB) error { // quoteVal quotes values to be used at ALTER ROLE SET param = value if necessary func quoteParameterValue(name, val string) string { - fmt.Println("param: ", name, "val: ", val) start := val[0] end := val[len(val)-1] if name == "search_path" {