jackc / jackc/pgx

Custom ColumnTypeScanType

Open
#2,245 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
14.3k
Forks
1.1k
Avg merge
6d 9h
Merged PRs (30d)
11

Description

Is there a way to change the default scanType for a pgType?
for example I have a custom type for sql date types and it has implemented Scan and Value methods, but when I have a dynamic query and pass map[string]any as gorm Scan input, it still uses time.Time{} for date types.
And also for database numeric type it is using float64 which in some cases the number overflows.

Contributor guide

Open the contributing guide

Research direction

Start by tracing how PostgreSQL date and numeric types choose their default scan types when a dynamic query is scanned into map[string]any. Compare that path with custom Scan and Value implementations, then determine whether configurable scan types can cover both date and numeric values without overflow; done means the requested behavior is specified and covered by tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, postgresql
Domain
backend, databases
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.