{
  "schema": 1,
  "sqlstate": "42P03",
  "condition_name": "duplicate_cursor",
  "sources": [
    {
      "id": "src.errcodes.42P03.18.6",
      "kind": "upstream_source",
      "source_role": "condition_definition",
      "tag": "REL_18_6",
      "commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
      "path": "src/backend/utils/errcodes.txt",
      "location": "line 378",
      "sha256": "6e8de346643ba84aa3c9c6a73360acfc7b2dfb89162c06c08ce9bf5bcd5bbcba",
      "url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/utils/errcodes.txt#L378"
    },
    {
      "id": "src.call.42P03.800a8278cf453417f5af6d6e",
      "kind": "upstream_source",
      "source_role": "source_call",
      "tag": "REL_18_6",
      "commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
      "path": "src/backend/utils/mmgr/portalmem.c",
      "location": "lines 185-187",
      "sha256": "8e29a302a7837316765acc798f9ff6eb22a330e8098a02794cd4d683601d3b04",
      "url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/utils/mmgr/portalmem.c#L185-L187"
    },
    {
      "id": "src.call.42P03.208bdd3b576b5021fb35916d",
      "kind": "upstream_source",
      "source_role": "source_call",
      "tag": "REL_18_6",
      "commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
      "path": "src/backend/utils/mmgr/portalmem.c",
      "location": "lines 189-192",
      "sha256": "8e29a302a7837316765acc798f9ff6eb22a330e8098a02794cd4d683601d3b04",
      "url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/utils/mmgr/portalmem.c#L189-L192"
    },
    {
      "id": "src.call.42P03.06c0580b43488eece2de1973",
      "kind": "upstream_source",
      "source_role": "source_call",
      "tag": "REL_18_6",
      "commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
      "path": "src/pl/plpgsql/src/pl_exec.c",
      "location": "lines 2895-2897",
      "sha256": "0df3c70a6bccf6dddf443fb99e152a16a67009827c44a820597e98e585cb8b20",
      "url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/pl/plpgsql/src/pl_exec.c#L2895-L2897"
    },
    {
      "id": "src.calls.REL_18_6.42P03",
      "kind": "local_artifact",
      "source_role": "source_call_scan",
      "sha256": "9ee8a0e81d8f0825c5c1ae45583439859a26e602bdd4ce2f2a62aa278867ccbf"
    }
  ],
  "claims": [
    {
      "id": "identity.class-and-condition",
      "statement": "42P03 is the duplicate_cursor condition in Class 42.",
      "method": "Read fixed REL_18_6 errcodes.txt and locked facts.",
      "limits": "Identity does not enumerate all source branches or client failures.",
      "sources": [
        "src.errcodes.42P03.18.6"
      ]
    },
    {
      "id": "mechanism.selected-source-path",
      "statement": "CreatePortal(name, allowDup, dupSilent) reports ERROR `cursor \"%s\" already exists` when allowDup is false, can report WARNING `closing existing cursor \"%s\"` before dropping a duplicate when allowDup is true and dupSilent is false, and PL/pgSQL separately reports ERROR `cursor \"%s\" already in use` when SPI_cursor_find finds an active named cursor.",
      "method": "Read complete resolved REL_18_6 report groups and message roles.",
      "limits": "Representative confirmed core paths only; not exhaustive historical or extension coverage.",
      "sources": [
        "src.call.42P03.800a8278cf453417f5af6d6e",
        "src.call.42P03.208bdd3b576b5021fb35916d",
        "src.call.42P03.06c0580b43488eece2de1973"
      ]
    },
    {
      "id": "versions.catalogue-boundary",
      "statement": "From 7.4 through 18.6 and 19beta3; the selected portal-manager and PL/pgSQL branches are fixed 18.6 source paths and runtime was not run.",
      "method": "Read locked catalogue facts and definition snapshots.",
      "limits": "First observed release is a lower bound, not precise behavioral introduction.",
      "sources": [
        "src.errcodes.42P03.18.6"
      ]
    }
  ],
  "messages": [
    {
      "id": "message.variant-1",
      "sqlstate": "42P03",
      "severity_source": "explicit ERROR",
      "primary_template": "cursor \"%s\" already exists",
      "detail_templates": [],
      "hint_templates": [],
      "roles": [
        {
          "role": "errmsg",
          "template": "cursor \"%s\" already exists"
        }
      ],
      "sources": [
        "src.call.42P03.800a8278cf453417f5af6d6e"
      ],
      "limits": "Placeholders remain dynamic source fields; no concrete runtime value is claimed."
    },
    {
      "id": "message.variant-2",
      "sqlstate": "42P03",
      "severity_source": "explicit WARNING",
      "primary_template": "closing existing cursor \"%s\"",
      "detail_templates": [],
      "hint_templates": [],
      "roles": [
        {
          "role": "errmsg",
          "template": "closing existing cursor \"%s\""
        }
      ],
      "sources": [
        "src.call.42P03.208bdd3b576b5021fb35916d"
      ],
      "limits": "Placeholders remain dynamic source fields; no concrete runtime value is claimed."
    },
    {
      "id": "message.variant-3",
      "sqlstate": "42P03",
      "severity_source": "explicit ERROR",
      "primary_template": "cursor \"%s\" already in use",
      "detail_templates": [],
      "hint_templates": [],
      "roles": [
        {
          "role": "errmsg",
          "template": "cursor \"%s\" already in use"
        }
      ],
      "sources": [
        "src.call.42P03.06c0580b43488eece2de1973"
      ],
      "limits": "Placeholders remain dynamic source fields; no concrete runtime value is claimed."
    }
  ],
  "usage_evidence": [
    {
      "scope": "SQLSTATE definition and release identity",
      "status": "definition_only",
      "evidence_ids": [
        "identity.class-and-condition",
        "src.errcodes.42P03.18.6"
      ]
    },
    {
      "scope": "Selected PostgreSQL 18.6 source emitters and message roles",
      "status": "source_path_confirmed",
      "evidence_ids": [
        "mechanism.selected-source-path"
      ]
    },
    {
      "scope": "Natural runtime execution for this batch",
      "status": "unknown",
      "evidence_ids": []
    }
  ],
  "runtime": []
}
