go-gorm / go-gorm/postgres

1.4.6 breaks enums

Open
#171 2 comments 0 reactions 1 assignee Claimed by @jinzhu View on GitHub
Dominant language
Go
Stars
297
Forks
155
Avg merge
27m
Merged PRs (30d)
2

Description

## GORM Playground Link

https://github.com/go-gorm/playground/pull/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)
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.