Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

升级gorm 使用postgres后报错 LastInsertId is not supported by this driver #6926

Closed
943885179 opened this issue Mar 27, 2024 · 6 comments
Assignees
Labels

Comments

@943885179
Copy link

原来使用正常,版本为
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,
无法插入数据

@github-actions github-actions bot added the type:missing reproduction steps missing reproduction steps label Mar 27, 2024
Copy link

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.ioSearch Before Asking

@943885179
Copy link
Author

go-gorm/playground#708

Copy link

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.ioSearch Before Asking

@jinzhu
Copy link
Member

jinzhu commented Mar 28, 2024

Upgrade GORM to v1.25.9

@jinzhu jinzhu closed this as completed Mar 28, 2024
@943885179
Copy link
Author

image
create 正常可以了,但是先求和再更新还是存在问题,可以看https://github.com/go-gorm/playground/issues/708复现

@adon68
Copy link

adon68 commented Jul 23, 2024

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

这是我遇到的LastInsertId 问题

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants