Skip to content

Commit

Permalink
Alter sequences owner implementation (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
anshajsingh authored Jan 28, 2025
1 parent f9ddf70 commit 9ae0840
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion adapter/basic/basic_roles.go
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ func (sa ServiceAdapter) GrantUsersAccordingRoles(ctx context.Context, dbName st
// altering owners for DB resources
alterOperations := map[string]func(string, string, string) string{
getTablesListQuery(schema, isExternalPg): alterOwnerForTable,
getSequenceListQuery(schema, isExternalPg): alterOwnerForTable,
getSequenceListQuery(schema, isExternalPg): alterOwnerForSequence,
getLargeObjectsListQuery(isExternalPg): alterOwnerForLargeObject,
getViewsListQuery(schema, isExternalPg): alterViewOwnerQuery,
getFunctionsListQuery(schema, isExternalPg): alterFunctionOwnerQuery,
Expand Down
4 changes: 4 additions & 0 deletions adapter/basic/sql_helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,10 @@ func alterOwnerForTable(schema, tableName, userName string) string {
return fmt.Sprintf("ALTER TABLE \"%s\".\"%s\" OWNER TO \"%s\"", schema, tableName, userName)
}

func alterOwnerForSequence(sequenceName, schema, newOwner string) string {
return fmt.Sprintf(`ALTER SEQUENCE "%s"."%s" OWNER TO "%s"`, schema, sequenceName, newOwner)
}

func alterOwnerForLargeObject(schema, oid, userName string) string {
return fmt.Sprintf("ALTER LARGE OBJECT %s OWNER TO \"%s\";", oid, userName) //TODO:
}
Expand Down

0 comments on commit 9ae0840

Please sign in to comment.