Gorm: Postgresql: setting charset and parseTime

Created on 22 Dec 2014  路  4Comments  路  Source: go-gorm/gorm

Hello!
I'm trying to connect to my postgresql database.
I'm trying:

gorm.Open("postgres", fmt.Sprintf(`user=%v password=%v dbname=%v
    sslmode=disable ?charset=utf8&parseTime=true`,
    "db_user", "db_pass", "db_name"))

and get:

pq: unrecognized configuration parameter "?charset"

With mysql everything works.
How to use this params with postgresql?

Most helpful comment

Also interested in the postgres solution!

All 4 comments

this is only supported by mysql driver, but not pq driver.

https://github.com/go-sql-driver/mysql#timetime-support

https://github.com/lib/pq

@jinzhu I'm getting this error:

(sql: Scan error on column index 3: unsupported driver -> Scan pair: []uint8 -> *time.Time) 

and in other solutions it is suggested to use parseTime=true, but from this it seems like we can't do this if we're on postgres, which is what I am using. What's the solution for postgres?

Also interested in the postgres solution!

I realize this is closed, but I'm also looking for a postgres solution.

Was this page helpful?
0 / 5 - 0 ratings