{
  "id": "go/database-sql-null-value-in-non-null-column",
  "signature": "error: sql: Scan error on column index 2: converting NULL to string is unsupported",
  "signature_zh": "错误：sql：列索引2上的扫描错误：不支持将NULL转换为string",
  "regex": "error:\\ sql:\\ Scan\\ error\\ on\\ column\\ index\\ 2:\\ converting\\ NULL\\ to\\ string\\ is\\ unsupported",
  "domain": "go",
  "category": "data_error",
  "subcategory": null,
  "root_cause": "Scanning a NULL database value into a non-nullable Go type, such as string or int, without using sql.Null* types.",
  "root_cause_type": "generic",
  "root_cause_zh": "将NULL数据库值扫描到不可为空的Go类型，如string或int，而未使用sql.Null*类型。",
  "versions": [
    {
      "version": "1.20",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "1.21",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "Using default values manually",
      "why_fails": "May mask actual NULL meaning; use NullString for proper handling.",
      "fail_rate": 0.5,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Use sql.NullString and similar types",
      "success_rate": 0.95,
      "how": "var name sql.NullString\nif err := rows.Scan(&name); err != nil { return err }\nif name.Valid { /* use name.String */ } else { /* handle NULL */ }",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": null,
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.87,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2025-10-05",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}