Skip to content

Commit

Permalink
🐛 (pgsql driver) add returning id with "" quote
Browse files Browse the repository at this point in the history
  • Loading branch information
Insua committed Jun 7, 2024
1 parent 77961c6 commit 9cdfec9
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion contrib/drivers/pgsql/pgsql_do_exec.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ package pgsql
import (
"context"
"database/sql"
"fmt"
"strings"

"github.com/gogf/gf/v2/database/gdb"
Expand Down Expand Up @@ -55,7 +56,7 @@ func (d *Driver) DoExec(ctx context.Context, link gdb.Link, sql string, args ...
// check if it is an insert operation.
if !isUseCoreDoExec && pkField.Name != "" && strings.Contains(sql, "INSERT INTO") {
primaryKey = pkField.Name
sql += " RETURNING " + primaryKey
sql += fmt.Sprintf(` RETURNING "%s"`, primaryKey)
} else {
// use default DoExec
return d.Core.DoExec(ctx, link, sql, args...)
Expand Down

0 comments on commit 9cdfec9

Please sign in to comment.