From 1eba30725087e149f180ee8f2815fd5d8b94eb1e Mon Sep 17 00:00:00 2001 From: Franco Liberali Date: Sun, 8 Oct 2023 05:22:06 +0200 Subject: [PATCH] add from as valid clause for update (#213) --- postgres.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/postgres.go b/postgres.go index dbeabf5..6d2ab5f 100644 --- a/postgres.go +++ b/postgres.go @@ -3,11 +3,11 @@ package postgres import ( "database/sql" "fmt" - "github.com/jackc/pgx/v5" "regexp" "strconv" "strings" + "github.com/jackc/pgx/v5" "github.com/jackc/pgx/v5/stdlib" "gorm.io/gorm" "gorm.io/gorm/callbacks" @@ -46,7 +46,7 @@ var timeZoneMatcher = regexp.MustCompile("(time_zone|TimeZone)=(.*?)($|&| )") func (dialector Dialector) Initialize(db *gorm.DB) (err error) { callbackConfig := &callbacks.Config{ CreateClauses: []string{"INSERT", "VALUES", "ON CONFLICT"}, - UpdateClauses: []string{"UPDATE", "SET", "WHERE"}, + UpdateClauses: []string{"UPDATE", "SET", "FROM", "WHERE"}, DeleteClauses: []string{"DELETE", "FROM", "WHERE"}, } // register callbacks