jackc / jackc/pgx

Custom type implementation fails to scan bigint

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

Description

Hello,

I have a custom type implementation for uint256.Int types, modelled after the shopspring decimal type support.

I'm facing a strange issue wrt. scanning. Basically, encoding uint256.Int's works for any underlying intX/numeric postgres type, but scanning only works for numeric types and fails f.i. for bigint with "`can't scan into dest[3]: unsupported type`".

Type registrations are exactly like in the shopspring decimal support. I also verified that the custom type properly implements Int64Scanner (besides NumericScanner). I also tried adding a Int8 Codec, but that did not make any difference.

I'd be grateful for any hints what the problem might be.

Contributor guide

Open the contributing guide

Research direction

Start by examining the custom type registrations and the scanning paths for PostgreSQL numeric and bigint values. Compare the implemented Int64Scanner and NumericScanner behavior, including the attempted Int8 Codec. Done means identifying why bigint scanning reports an unsupported type and confirming that the custom uint256.Int type scans successfully from bigint as well as numeric.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, postgresql
Domain
database
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.