go-gorm / postgres

GORM PostgreSQL driver
MIT License
225 stars 119 forks source link

When switching from v1.4.5 to v1.4.6 or above: "cannot find encode plan" on timestampz #266

Open mlebihan opened 5 months ago

mlebihan commented 5 months ago

Description

When upgrading from gorm.io/driver/postgres v1.4.4 or gorm.io/driver/postgres v1.4.5
to gorm.io/driver/postgres v1.4.6 or greater versions (still failling with v1.5.7)

I receive the message when I attempt to do a creation : unable to encode util.DateTime{wall:0x7a1200, ext:63843952170, loc:(*time.Location)(nil)} into binary format for timestamptz (OID 1184): cannot find encode plan

with util.DateTime a

package util
type DateTime time.Time

The only thing I see changing from v1.4.5 to v1.4.6 is the incoming of github.com/jackc/pgx/v5 v5.2.0 by a go mod tidy in place of the github.com/jackc/pgx/v4 that was used before. I don't know if it's related.

Link

It seems that other users encounter the same kind of problem, with a timestamp too, with another OID 1185 instead of 1184 for me:

[Inserting Array of Time in Postgres via Gorm](https://stackoverflow.com/questions/75043520/inserting-array-of-time-in-postgres-via-gorm)