Skip to content

chore: upgrade GORM and database drivers#1262

Open
zhangzhenghao wants to merge 9 commits intogorse-io:masterfrom
zhangzhenghao:upgrade-gorm
Open

chore: upgrade GORM and database drivers#1262
zhangzhenghao wants to merge 9 commits intogorse-io:masterfrom
zhangzhenghao:upgrade-gorm

Conversation

@zhangzhenghao
Copy link
Copy Markdown
Contributor

Changes

Upgraded GORM and database drivers to latest versions:

Package Old Version New Version
gorm.io/gorm v1.23.6 v1.31.1
gorm.io/driver/mysql v1.3.4 v1.6.0
gorm.io/driver/postgres v1.3.5 v1.6.0
gorm.io/driver/sqlite v1.3.4 v1.6.0
gorm.io/driver/clickhouse v0.4.2 v0.7.0

Notes

  • Removed sqlite fork replace (incompatible with new GORM API)
  • Updated clickhouse fork replace to match v0.7.0
  • Build verified successfully

Benefits

  • Access to latest GORM features and bug fixes
  • Better performance and stability
  • Updated dependencies (pgx v5, clickhouse-go v2, etc.)

- gorm.io/gorm: v1.23.6 -> v1.31.1
- gorm.io/driver/mysql: v1.3.4 -> v1.6.0
- gorm.io/driver/postgres: v1.3.5 -> v1.6.0
- gorm.io/driver/sqlite: v1.3.4 -> v1.6.0
- gorm.io/driver/clickhouse: v0.4.2 -> v0.7.0

- Updated clickhouse fork to latest version (ab309f5) with gorm v1.30.0
- Updated sqlite fork to latest version (eb865ec) with modernc.org/sqlite
- Build verified successfully
zhenghaoz added 7 commits May 3, 2026 09:53
Empty RecommendConfig{} causes CacheSize=0, which triggers
LIMIT 0 in SQLite fork and returns empty result sets.
govet's inline check reports false positives for generic functions
where type parameter inference is not yet supported.
lib/pq driver has compatibility issues with new GORM versions,
causing 'pq: got 2 parameters but the statement requires 1' errors.

Changes:
- Replace lib/pq driver with pgx/v5/stdlib
- Update otelsql.Open calls from 'postgres' to 'pgx'
- Update test files to use pgx driver

pq.StringArray type is kept for PostgreSQL array handling.
- Replace lib/pq driver with pgx/v5/stdlib
- Add timezone=UTC parameter to PostgreSQL URIs
- pq.StringArray type kept for PostgreSQL array handling

lib/pq has compatibility issues with new GORM versions causing
'pq: got 2 parameters but the statement requires 1' errors.

Note: pgx stdlib mode interprets timestamp without time zone in
local timezone. Tests may pass in UTC CI environments.
Timezone handling was incorrectly added to MySQL, ClickHouse and
SQLite Register functions where it modified 'path' but was never
used. Only PostgreSQL Register needs timezone handling for pgx.
GORM PostgreSQL driver expects 'time_zone' or 'TimeZone' parameter
for proper timezone handling. Changed from lowercase 'timezone' to
'time_zone' in all PostgreSQL URI construction.
- Replace otelsql.Open with stdlib.OpenDB from pgx config
- Set RuntimeParams['timezone'] = 'UTC' for proper timestamp handling
- Note: Local timezone tests may fail; CI (UTC) should pass
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants