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

1.4.6 breaks enums #171

Open
zchenyu opened this issue Mar 24, 2023 · 2 comments
Open

1.4.6 breaks enums #171

zchenyu opened this issue Mar 24, 2023 · 2 comments
Assignees

Comments

@zchenyu
Copy link

zchenyu commented Mar 24, 2023

GORM Playground Link

go-gorm/playground#586

Description

This test fails after upgrading gorm.io/driver/postgres from v1.4.5 to v1.4.6

The test adds an enum type that contains a String() method

2023/03/24 14:56:40 testing postgres...
=== RUN   TestGORM

2023/03/24 14:56:40 /home/zchenyu/git8/playground/main_test.go:17 ERROR: invalid input syntax for type integer: "ONE" (SQLSTATE 22P02)
[1.317ms] [rows:0] INSERT INTO "companies" ("name","my_enum") VALUES ('jinzhu',1) RETURNING "id"

2023/03/24 14:56:40 /home/zchenyu/git8/playground/main_test.go:20 record not found
[0.721ms] [rows:0] SELECT * FROM "companies" WHERE "companies"."id" = 0 ORDER BY "companies"."id" LIMIT 1
    main_test.go:21: Failed, got error: record not found

Expected (with v1.4.5):

testing postgres...
2023/03/24 14:55:46 testing postgres...
=== RUN   TestGORM

2023/03/24 14:55:46 /home/zchenyu/git8/playground/main_test.go:17
[5.801ms] [rows:1] INSERT INTO "companies" ("name","my_enum") VALUES ('jinzhu',1) RETURNING "id"

2023/03/24 14:55:46 /home/zchenyu/git8/playground/main_test.go:20
[0.643ms] [rows:1] SELECT * FROM "companies" WHERE "companies"."id" = 1 ORDER BY "companies"."id" LIMIT 1
--- PASS: TestGORM (0.01s)
@zchenyu
Copy link
Author

zchenyu commented Mar 24, 2023

I noticed this only happens if PreferSimpleProtocol is set to true.

@zchenyu
Copy link
Author

zchenyu commented Jun 23, 2023

Bump. Any update on this?
I'd like to be able to upgrade to latest to get this feature: https://github.com/go-gorm/postgres/pull/179/files

But I'm blocked by this bug

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

Successfully merging a pull request may close this issue.

2 participants