Skip to content

Commit

Permalink
fixed nil error
Browse files Browse the repository at this point in the history
  • Loading branch information
brennanjl committed Jun 4, 2024
1 parent ff83b85 commit 8619833
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions internal/engine/execution/procedure.go
Original file line number Diff line number Diff line change
Expand Up @@ -584,12 +584,19 @@ func (p *preparedProcedure) shapeReturn(result *sql.ResultSet) error {
// if it is an array, we need to convert each value in the array
if col.Type.IsArray {
for _, row := range result.Rows {
if row[i] == nil {
continue
}

arr, ok := row[i].([]any)
if !ok {
return fmt.Errorf("shapeReturn: expected decimal array, got %T", row[i])
}

for _, v := range arr {
if v == nil {
continue
}
dec, ok := v.(*decimal.Decimal)
if !ok {
return fmt.Errorf("shapeReturn: expected decimal, got %T", dec)
Expand All @@ -602,6 +609,10 @@ func (p *preparedProcedure) shapeReturn(result *sql.ResultSet) error {
}
} else {
for _, row := range result.Rows {
if row[i] == nil {
continue
}

dec, ok := row[i].(*decimal.Decimal)
if !ok {
return fmt.Errorf("shapeReturn: expected decimal, got %T", row[i])
Expand Down

0 comments on commit 8619833

Please sign in to comment.