sql: Scan error on column index 5: unsupported Scan, storing driver.Value type into type *time.Time

What to do On this error :

SQL: Scan error on column index 5: unsupported Scan, storing driver.Value type <nil> into type *time.Time

This error came because default timestamp value was null in the database, and during scan via DB’s SQL row. Scan method returned above error, technically it was trying to assign nil value, Go Language doesn’t assign nil value – refer: https://golang.org/ref/spec

To fix the issue, I changed the field in database table like below, and then it worked,

account_created_at timestamp default to_timestamp((0)::double precision) not null,

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s