{
  "id": "python/sqlalchemy-invalid-operator-for-type",
  "signature": "sqlalchemy.exc.ProgrammingError: (psycopg2.errors.UndefinedFunction) operator does not exist: character varying = integer",
  "signature_zh": "操作符不存在：字符变化 = 整数",
  "regex": "sqlalchemy\\.exc\\.ProgrammingError:\\ \\(psycopg2\\.errors\\.UndefinedFunction\\)\\ operator\\ does\\ not\\ exist:\\ character\\ varying\\ =\\ integer",
  "domain": "python",
  "category": "type_error",
  "subcategory": null,
  "root_cause": "Comparing a string column with an integer value in a query without proper type casting.",
  "root_cause_type": "generic",
  "root_cause_zh": "在查询中将字符串列与整数值比较，未进行正确的类型转换。",
  "versions": [
    {
      "version": "3.x",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "If the column is string and you pass string, it may work, but can cause implicit casts and performance issues; not robust.",
      "fail_rate": 0.4,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Data inconsistency leads to runtime failures.",
      "fail_rate": 0.8,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.9,
      "how": "from sqlalchemy import cast, Integer\nresult = session.query(User).filter(cast(User.age, Integer) == 25).all()",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.95,
      "how": "class User(Base):\n    __tablename__ = 'users'\n    age = Column(Integer)  # not String",
      "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.83,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-07-11",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}