{
  "schema": 1,
  "sqlstate": "22P06",
  "condition_name": "nonstandard_use_of_escape_character",
  "sources": [
    {
      "id": "src.errcodes.18.6",
      "kind": "upstream_source",
      "source_role": "condition_definition",
      "tag": "REL_18_6",
      "commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
      "path": "src/backend/utils/errcodes.txt",
      "sha256": "6e8de346643ba84aa3c9c6a73360acfc7b2dfb89162c06c08ce9bf5bcd5bbcba",
      "url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/utils/errcodes.txt#L183",
      "lines": "183"
    },
    {
      "id": "src.path.guc",
      "kind": "upstream_source",
      "source_role": "resolved_report_context",
      "tag": "REL_18_6",
      "commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
      "path": "src/backend/parser/scan.l",
      "sha256": "bf453f1ae3c22b84fea6f8e8bed4fda476b7cfa49b234efbf92ca228234d0293",
      "url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/parser/scan.l#L62",
      "lines": "62-70"
    },
    {
      "id": "src.path.literal-mode",
      "kind": "upstream_source",
      "source_role": "resolved_report_context",
      "tag": "REL_18_6",
      "commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
      "path": "src/backend/parser/scan.l",
      "sha256": "bf453f1ae3c22b84fea6f8e8bed4fda476b7cfa49b234efbf92ca228234d0293",
      "url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/parser/scan.l#L545-L560",
      "lines": "545-560"
    },
    {
      "id": "src.path.error-guard",
      "kind": "upstream_source",
      "source_role": "resolved_report_context",
      "tag": "REL_18_6",
      "commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
      "path": "src/backend/parser/scan.l",
      "sha256": "bf453f1ae3c22b84fea6f8e8bed4fda476b7cfa49b234efbf92ca228234d0293",
      "url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/parser/scan.l#L706",
      "lines": "706-720"
    },
    {
      "id": "src.path.warning",
      "kind": "upstream_source",
      "source_role": "resolved_report_context",
      "tag": "REL_18_6",
      "commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
      "path": "src/backend/parser/scan.l",
      "sha256": "bf453f1ae3c22b84fea6f8e8bed4fda476b7cfa49b234efbf92ca228234d0293",
      "url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/parser/scan.l#L1423",
      "lines": "1423-1448"
    },
    {
      "id": "src.path.escape-warning",
      "kind": "upstream_source",
      "source_role": "resolved_report_context",
      "tag": "REL_18_6",
      "commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
      "path": "src/backend/parser/scan.l",
      "sha256": "bf453f1ae3c22b84fea6f8e8bed4fda476b7cfa49b234efbf92ca228234d0293",
      "url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/parser/scan.l#L1450",
      "lines": "1450-1460"
    },
    {
      "id": "src.path.scanner-copy",
      "kind": "upstream_source",
      "source_role": "resolved_report_context",
      "tag": "REL_18_6",
      "commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
      "path": "src/backend/parser/scan.l",
      "sha256": "bf453f1ae3c22b84fea6f8e8bed4fda476b7cfa49b234efbf92ca228234d0293",
      "url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/parser/scan.l#L1262",
      "lines": "1262-1268"
    }
  ],
  "claims": [
    {
      "id": "identity",
      "statement": "22P06 is nonstandard_use_of_escape_character in SQLSTATE Class 22.",
      "sources": [
        "src.errcodes.18.6"
      ],
      "method": "Read fixed definition."
    },
    {
      "id": "error-guard",
      "statement": "For an escape followed by a single quote, the scanner emits ERROR 22P06 when backslash_quote is off, or when safe-encoding mode is used with a client-only encoding. The primary and hint advise doubled quotes.",
      "sources": [
        "src.path.error-guard",
        "src.path.scanner-copy"
      ],
      "method": "Read the complete xe escape rule and scanner setting copy."
    },
    {
      "id": "warning-guards",
      "statement": "For ordinary non-E strings the scanner enters xe only when standard_conforming_strings is off and initializes warn_on_first_escape for warning checks. Explicit E strings enter xe with warn_on_first_escape false, so they avoid this legacy first-escape WARNING while remaining subject to the backslash_quote ERROR guard. With escape_string_warning enabled on the warning path, the scanner emits one WARNING per string for backslash-quote, backslash-backslash, or another escape.",
      "sources": [
        "src.path.literal-mode",
        "src.path.warning",
        "src.path.escape-warning"
      ],
      "method": "Read ordinary and explicit-E literal-mode selection and all three warning branches."
    },
    {
      "id": "severity-boundary",
      "statement": "The ERROR rejects the current statement; WARNING is a warning diagnostic and does not by itself abort the statement or explicit transaction.",
      "sources": [
        "src.path.error-guard",
        "src.path.warning",
        "src.path.escape-warning"
      ],
      "method": "Read ereport severity at each branch.",
      "limits": "No locale runtime was executed."
    },
    {
      "id": "history",
      "statement": "The locked catalogue records 22P06 from 8.1.0; that boundary does not prove exact implementation introduction.",
      "sources": [
        "src.errcodes.18.6"
      ],
      "method": "Use catalogue boundary."
    }
  ],
  "messages": [
    {
      "id": "message.error",
      "sqlstate": "22P06",
      "primary_template": "unsafe use of \\' in a string literal",
      "severity_source": "ERROR",
      "sources": [
        "src.path.error-guard"
      ],
      "hint_template": "Use '' to write quotes in strings. \\' is insecure in client-only encodings."
    },
    {
      "id": "message.quote-warning",
      "sqlstate": "22P06",
      "primary_template": "nonstandard use of \\' in a string literal",
      "severity_source": "WARNING",
      "sources": [
        "src.path.warning"
      ],
      "hint_template": "Use '' to write quotes in strings, or use the escape string syntax (E'...')."
    },
    {
      "id": "message.backslash-warning",
      "sqlstate": "22P06",
      "primary_template": "nonstandard use of \\\\ in a string literal",
      "severity_source": "WARNING",
      "sources": [
        "src.path.warning"
      ],
      "hint_template": "Use the escape string syntax for backslashes, e.g., E'\\\\'."
    },
    {
      "id": "message.escape-warning",
      "sqlstate": "22P06",
      "primary_template": "nonstandard use of escape in a string literal",
      "severity_source": "WARNING",
      "sources": [
        "src.path.escape-warning"
      ],
      "hint_template": "Use the escape string syntax for escapes, e.g., E'\\r\\n'."
    }
  ],
  "usage_evidence": [
    {
      "scope": "definition",
      "status": "definition_only",
      "evidence_ids": [
        "identity"
      ]
    },
    {
      "scope": "fixed-source-path",
      "status": "source_path_confirmed",
      "evidence_ids": [
        "error-guard",
        "warning-guards",
        "severity-boundary"
      ]
    },
    {
      "scope": "history",
      "status": "unknown",
      "evidence_ids": [
        "history"
      ]
    },
    {
      "scope": "natural-runtime",
      "status": "unknown",
      "evidence_ids": [
        "error-guard",
        "warning-guards",
        "severity-boundary"
      ]
    }
  ],
  "runtime": []
}
