Skip to content

Commit

Permalink
Fixes #94: pgx doesn't support LastInsertId
Browse files Browse the repository at this point in the history
  • Loading branch information
qiangxue committed Sep 25, 2020
1 parent c0868b7 commit 4d1628e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion model_query.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ func (q *ModelQuery) Insert(attrs ...string) error {
}

func insertAndReturnPK(db *DB, query *Query, pkName string) (int64, error) {
if db.DriverName() != "postgres" {
if db.DriverName() != "postgres" && db.DriverName() != "pgx" {
result, err := query.Execute()
if err != nil {
return 0, err
Expand Down

0 comments on commit 4d1628e

Please sign in to comment.