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

- **ID:** `go/unsupported-scan-type`
- **Domain:** go
- **Category:** data_error
- **Verification:** ai_generated
- **Fix Rate:** 90%

## Root Cause

The database returned a NULL value for a column that is mapped to a non-pointer Go type like time.Time, which cannot represent nil.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| go1.21 | active | — | — |
| go1.22 | active | — | — |
| go1.23 | active | — | — |

## Workarounds

1. **Use a pointer type for the Go field, e.g., *time.Time instead of time.Time, to allow nil values.** (95% success)
   ```
   Use a pointer type for the Go field, e.g., *time.Time instead of time.Time, to allow nil values.
   ```
2. **Use sql.NullTime type from the database/sql package to handle nullable timestamps.** (90% success)
   ```
   Use sql.NullTime type from the database/sql package to handle nullable timestamps.
   ```

## Dead Ends

- **Changing the column type in the database to NOT NULL.** — This may break existing data or require schema migration; also not always under developer control. (50% fail)
- **Using a default value in the SQL query with COALESCE.** — COALESCE changes the query result but may mask missing data; also requires modifying every query. (40% fail)
