{
  "id": "php/pdo-unknown-column-type",
  "signature": "PDOException: SQLSTATE[HY000]: General error: 2053 SQLSTATE[HY000]: General error: 2053 when fetching data from table 'orders' with column 'total_amount' in /var/www/app/src/Repository/OrderRepository.php:42",
  "signature_zh": "PDOException：SQLSTATE[HY000]：一般错误：2053，从表 'orders' 的列 'total_amount' 获取数据时出错，位于 /var/www/app/src/Repository/OrderRepository.php 第 42 行",
  "regex": "SQLSTATE\\[HY000\\]: General error: 2053 when fetching data from table '[^']+' with column '[^']+' in .* on line \\d+",
  "domain": "php",
  "category": "data_error",
  "subcategory": null,
  "root_cause": "PDO driver (e.g., MySQL or PostgreSQL) cannot map a database column type to a PHP type, often due to custom enum types, unsupported geometries, or corrupted column metadata.",
  "root_cause_type": "generic",
  "root_cause_zh": "PDO 驱动（如 MySQL 或 PostgreSQL）无法将数据库列类型映射到 PHP 类型，通常是由于自定义枚举类型、不支持的几何类型或损坏的列元数据。",
  "versions": [
    {
      "version": "PHP 8.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "PHP 8.1",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "PHP 8.2",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "MySQL 8.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "MySQL 8.4",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "PostgreSQL 15",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "PostgreSQL 16",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "The column type definition is static; restarting does not change how PDO interprets it.",
      "fail_rate": 0.95,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "The error is specific to certain column types, not a general driver failure.",
      "fail_rate": 0.8,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "The error occurs during data retrieval before fetch mode is applied.",
      "fail_rate": 0.85,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Cast the problematic column in the SQL query to a standard type, e.g., `SELECT CAST(total_amount AS DECIMAL(10,2)) AS total_amount FROM orders`.",
      "success_rate": 0.85,
      "how": "Cast the problematic column in the SQL query to a standard type, e.g., `SELECT CAST(total_amount AS DECIMAL(10,2)) AS total_amount FROM orders`.",
      "condition": "",
      "sources": []
    },
    {
      "action": "Update the column type in the database to a standard type like DECIMAL or DOUBLE; for custom enums, use a VARCHAR column instead.",
      "success_rate": 0.75,
      "how": "Update the column type in the database to a standard type like DECIMAL or DOUBLE; for custom enums, use a VARCHAR column instead.",
      "condition": "",
      "sources": []
    },
    {
      "action": "Use `PDO::ATTR_STRINGIFY_FETCHES` to force all fetched values to strings: `$pdo->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, true);`",
      "success_rate": 0.7,
      "how": "Use `PDO::ATTR_STRINGIFY_FETCHES` to force all fetched values to strings: `$pdo->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, true);`",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "在 SQL 查询中将有问题的列转换为标准类型，例如：`SELECT CAST(total_amount AS DECIMAL(10,2)) AS total_amount FROM orders`。",
    "将数据库中的列类型更新为标准类型（如 DECIMAL 或 DOUBLE）；对于自定义枚举，改用 VARCHAR 列。",
    "使用 `PDO::ATTR_STRINGIFY_FETCHES` 强制将所有获取的值转换为字符串：`$pdo->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, true);`"
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://www.php.net/manual/en/pdo.error-handling.php",
  "official_doc_section": null,
  "error_code": "2053",
  "verification_tier": "ai_generated",
  "confidence": 0.81,
  "fix_success_rate": 0.76,
  "resolvable": "partial",
  "first_seen": "2024-06-18",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}