# sql: Scan error on column index 3: converting NULL to string is unsupported

- **ID:** `go/database-scan-null-field`
- **Domain:** go
- **Category:** data_error
- **Verification:** ai_generated
- **Fix Rate:** 90%

## Root Cause

Scanning a NULL database value into a non-pointer Go type (e.g., string instead of *string or sql.NullString).

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| Go 1.18 | active | — | — |
| Go 1.19 | active | — | — |
| Go 1.20 | active | — | — |
| Go 1.21 | active | — | — |
| Go 1.22 | active | — | — |

## Workarounds

1. **Use sql.NullString or *string for nullable columns, then check .Valid before use** (95% success)
   ```
   Use sql.NullString or *string for nullable columns, then check .Valid before use
   ```
2. **Define custom struct fields as pointers to handle NULLs** (90% success)
   ```
   Define custom struct fields as pointers to handle NULLs
   ```

## Dead Ends

- **** — This masks the data issue and can lead to incorrect business logic if NULL has semantic meaning. (60% fail)
- **** — Pollutes the data and may break other queries or reports. (80% fail)
