原来使用正常,版本为 gorm.io/gorm v1.23.8 gorm.io/driver/postgres v1.3.9 升级后 gorm.io/gorm v1.25.8 gorm.io/driver/postgres v1.5.7 就报错了LastInsertId is not supported by this driver, 无法插入数据

Comment From: github-actions[bot]

The issue has been automatically marked as stale as it missing playground pull request link, which is important to help others understand your issue effectively and make sure the issue hasn't been fixed on latest master, checkout https://github.com/go-gorm/playground for details. it will be closed in 30 days if no further activity occurs. if you are asking question, please use the Question template, most likely your question already answered https://github.com/go-gorm/gorm/issues or described in the document https://gorm.io ✨ Search Before Asking

Comment From: 943885179

https://github.com/go-gorm/playground/issues/708

Comment From: github-actions[bot]

The issue has been automatically marked as stale as it missing playground pull request link, which is important to help others understand your issue effectively and make sure the issue hasn't been fixed on latest master, checkout https://github.com/go-gorm/playground for details. it will be closed in 30 days if no further activity occurs. if you are asking question, please use the Question template, most likely your question already answered https://github.com/go-gorm/gorm/issues or described in the document https://gorm.io ✨ Search Before Asking

Comment From: jinzhu

Upgrade GORM to v1.25.9

Comment From: 943885179

Gorm 升级gorm 使用postgres后报错 LastInsertId is not supported by this driver create 正常可以了,但是先求和再更新还是存在问题,可以看https://github.com/go-gorm/playground/issues/708复现

Comment From: adon68

如果使用的是 Postgresql 检查是否设置 WithoutReturning true 这回导致插入记录后 不会返回生成ID,导致插入失败.

这是我遇到的LastInsertId 问题