From b46b26920b1b58402b69ccde2923463005b5df68 Mon Sep 17 00:00:00 2001 From: insua Date: Fri, 7 Jun 2024 18:07:23 +0800 Subject: [PATCH] :bug: (pgsql driver) add returning id with "" quote --- contrib/drivers/pgsql/pgsql_do_exec.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/drivers/pgsql/pgsql_do_exec.go b/contrib/drivers/pgsql/pgsql_do_exec.go index 4bb233b5302..ca3f3a86e3b 100644 --- a/contrib/drivers/pgsql/pgsql_do_exec.go +++ b/contrib/drivers/pgsql/pgsql_do_exec.go @@ -9,6 +9,7 @@ package pgsql import ( "context" "database/sql" + "fmt" "strings" "github.com/gogf/gf/v2/database/gdb" @@ -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...)