Skip to content

Commit

Permalink
debugging where quotes get missing
Browse files Browse the repository at this point in the history
  • Loading branch information
FxKu committed Oct 17, 2024
1 parent 6b662d2 commit 46afe9c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
1 change: 0 additions & 1 deletion pkg/cluster/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -1395,7 +1395,6 @@ func (c *Cluster) initPreparedDatabaseRoles() error {
searchPathArr = append(searchPathArr, fmt.Sprintf("%q", preparedSchemaName))
}
searchPath := strings.Join(searchPathArr, ", ")
c.logger.Debugf("search_path for database %s: %s", preparedDbName, searchPath)

// default roles per database
if err := c.initDefaultRoles(defaultRoles, "admin", preparedDbName, searchPath, preparedDB.SecretNamespace); err != nil {
Expand Down
5 changes: 4 additions & 1 deletion pkg/util/users/users.go
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,9 @@ func produceAlterRoleSetStmts(user spec.PgUser) []string {
result := make([]string, 0)
result = append(result, fmt.Sprintf(alterRoleResetAllSQL, user.Name))
for name, value := range user.Parameters {
result = append(result, fmt.Sprintf(alterRoleSetSQL, user.Name, name, quoteParameterValue(name, value)))
stmt := fmt.Sprintf(alterRoleSetSQL, user.Name, name, quoteParameterValue(name, value))
fmt.Println("stmt: ", stmt)
result = append(result, stmt)
}
return result
}
Expand Down Expand Up @@ -314,6 +316,7 @@ 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" {
Expand Down

0 comments on commit 46afe9c

Please sign in to comment.