Skip to content

Commit

Permalink
fix proc id parsing for legacy id (#1550)
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-swinkler authored Feb 21, 2023
1 parent d0384b6 commit 266432d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
7 changes: 5 additions & 2 deletions pkg/resources/function_grant.go
Original file line number Diff line number Diff line change
Expand Up @@ -344,12 +344,15 @@ func parseFunctionGrantID(s string) (*FunctionGrantID, error) {
objectIdentifier = objectIdentifier[0:idx]
}
objectNameParts := strings.Split(objectIdentifier, "(")

argumentDataTypes := []string{}
if len(objectNameParts) > 1 {
argumentDataTypes = helpers.SplitStringToSlice(objectNameParts[1], ",")
}
return &FunctionGrantID{
DatabaseName: idParts[0],
SchemaName: idParts[1],
ObjectName: objectNameParts[0],
ArgumentDataTypes: helpers.SplitStringToSlice(objectNameParts[1], ","),
ArgumentDataTypes: argumentDataTypes,
Privilege: idParts[3],
Roles: helpers.SplitStringToSlice(idParts[4], ","),
Shares: []string{},
Expand Down
7 changes: 5 additions & 2 deletions pkg/resources/procedure_grant.go
Original file line number Diff line number Diff line change
Expand Up @@ -354,12 +354,15 @@ func parseProcedureGrantID(s string) (*ProcedureGrantID, error) {
objectIdentifier = objectIdentifier[0:idx]
}
objectNameParts := strings.Split(objectIdentifier, "(")

argumentDataTypes := []string{}
if len(objectNameParts) > 1 {
argumentDataTypes = helpers.SplitStringToSlice(objectNameParts[1], ",")
}
return &ProcedureGrantID{
DatabaseName: idParts[0],
SchemaName: idParts[1],
ObjectName: objectNameParts[0],
ArgumentDataTypes: helpers.SplitStringToSlice(objectNameParts[1], ","),
ArgumentDataTypes: argumentDataTypes,
Privilege: idParts[3],
Roles: helpers.SplitStringToSlice(idParts[4], ","),
Shares: []string{},
Expand Down

0 comments on commit 266432d

Please sign in to comment.