go-gorm / postgres

GORM PostgreSQL driver
MIT License
225 stars 119 forks source link

Failure to connect returns wrong error message in 1.5.5 #244

Closed aevitas closed 6 months ago

aevitas commented 6 months ago

GORM Playground Link

N/A

Description

When using version 1.5.4 of the Postgres driver, attempting to connect to a server that's unavailable results in the following (logical) error:

[error] failed to initialize database, got error failed to connect to `host=localhost user=postgres database=nf`: dial error (dial tcp 127.0.0.1:9920: connect: connection refused)

However, after upgrading to 1.5.5, I get an error about the migrator and m.GuessConstraintInterfaceAndTable being undefined:

# gorm.io/driver/postgres
../../go/pkg/mod/gorm.io/driver/postgres@v1.5.5/migrator.go:411:26: m.GuessConstraintInterfaceAndTable undefined (type Migrator has no field or method GuessConstraintInterfaceAndTable)

I would expect the failed to connect error message here.

jasonchuan commented 6 months ago

1.5.5 has been removed , please change it back to 1.5.4

aevitas commented 6 months ago

Alright that explains why I couldn't find a tag for it - reverting back to 1.5.4 and closing this issue. Thank you.

J-Rocke commented 6 months ago

Just as a sidenote. Deleting released version is not good practice and the better way would be to retract them next time. See: https://go.dev/ref/mod#go-mod-file-retract for more information on that. Just deleting it leads to some unwanted artifacts like breaking builds and https://pkg.go.dev/gorm.io/driver/postgres as well as go list -m -u gorm.io/driver/postgres still showing 1.5.5 as latest version.

jasonchuan commented 6 months ago

Just as a sidenote. Deleting released version is not good practice and the better way would be to retract them next time. See: https://go.dev/ref/mod#go-mod-file-retract for more information on that. Just deleting it leads to some unwanted artifacts like breaking builds and https://pkg.go.dev/gorm.io/driver/postgres as well as go list -m -u gorm.io/driver/postgres still showing 1.5.5 as latest version.

I agree , to educe impact .

rxbynerd commented 6 months ago

Bitten by this via Dependabot: to revert the mistaken bump, I used go get gorm.io/driver/postgres@v1.5.4