go-gorm / playground

GORM Playground (Please Create PR for this project to report issues)
MIT License
89 stars 678 forks source link

gorm v1.25.6 : Create error when using map[string]interface{} with Postgres #685

Open magellancl opened 7 months ago

magellancl commented 7 months ago

Explain your user case and expected results

Related to https://github.com/go-gormigrate/gormigrate/issues/217

This library is using customizable table and column name, so Create is used this way :

    columnName := "name"
    user := map[string]interface{}{columnName: "id"}
    err := DB.Table("users").Create(user).Error

which return the error "LastInsertId is not supported by this driver", instead of creating the record