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

Performing multiple migrations ends up in prepared statement cache error #5737

Closed
miguelsorianod opened this issue Oct 4, 2022 · 3 comments
Assignees
Labels
type:with reproduction steps with reproduction steps

Comments

@miguelsorianod
Copy link

GORM Playground Link

go-gorm/playground#523

Description

When Prepared Statements are enabled in gorm (using the PrepareStmt: true attribute in gorm.Config when creating a connection), if multiple database migrations are performed, when AutoMigrate is called multiple times to add new columns in a Table the following error is observed:

    main_test.go:55: Failed, got error: ERROR: cached plan must not change result type (SQLSTATE 0A000)

The issue seems related to Prepared Statements caching.

See the provided playground link for a reproducible case, more details and logs.

This error is observed when using gorm.io/gorm v1.23.10 (the latest gorm 1.x version at the moment of writing this message). This was detected when we were working in updating gorm.io/gorm v1.21.7 to v1.23.10. In v1.21.7 the issue does not seem to happen.

@a631807682
Copy link
Member

Upgrade postgres driver version, duplicated of go-gorm/postgres#102

@miguelsorianod
Copy link
Author

Hi @a631807682. As you can see in the playground link the version that is being used is gorm.io/driver/postgres v1.3.10 which is currently the latest tagged version and the issue can still be reproduced.

Can we reopen this issue?

Thank you.

@a631807682
Copy link
Member

complete via go-gorm/postgres#138

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

Successfully merging a pull request may close this issue.

3 participants