- Notifications
You must be signed in to change notification settings - Fork926
Description
Noticed in#16220. This causes some db calls to fail.
2025-01-22 06:24:00.489 [erro] coderd.dbrollup: failed to rollup data ...
error= execute transaction:
github.com/coder/coder/v2/coderd/database.(*sqlQuerier).runTx
/home/runner/work/coder/coder/coderd/database/db.go:214
- pq: character with byte sequence 0xce 0xbc in encoding "UTF8" has no equivalent in encoding "WIN1252"
Can be fixed by adding.Encoding("UTF8")
when launching built-in Postgres:
Lines 2008 to 2020 in923ef56
ep:=embeddedpostgres.NewDatabase( | |
embeddedpostgres.DefaultConfig(). | |
Version(embeddedpostgres.V13). | |
BinariesPath(filepath.Join(cfg.PostgresPath(),"bin")). | |
DataPath(filepath.Join(cfg.PostgresPath(),"data")). | |
RuntimePath(filepath.Join(cfg.PostgresPath(),"runtime")). | |
CachePath(cachePath). | |
Username("coder"). | |
Password(pgPassword). | |
Database("coder"). | |
Port(uint32(pgPort)). | |
Logger(stdlibLogger.Writer()), | |
) |
We already do it for the built-in Postgres we use in CI:
coder/scripts/embedded-pg/main.go
Lines 23 to 36 in923ef56
ep:=embeddedpostgres.NewDatabase( | |
embeddedpostgres.DefaultConfig(). | |
Version(embeddedpostgres.V16). | |
BinariesPath(filepath.Join(postgresPath,"bin")). | |
DataPath(filepath.Join(postgresPath,"data")). | |
RuntimePath(filepath.Join(postgresPath,"runtime")). | |
CachePath(filepath.Join(postgresPath,"cache")). | |
Username("postgres"). | |
Password("postgres"). | |
Database("postgres"). | |
Encoding("UTF8"). | |
Port(uint32(5432)). | |
Logger(os.Stdout), | |
) |
Before implementing the fix, we need to ensure that it won't break with an existing database when an admin upgrades Coder.