{
  "schema": 1,
  "sqlstate": "42883",
  "condition_name": "undefined_function",
  "runner": "scripts/verify_cases.py",
  "targets": {
    "latest": {
      "binary": "Homebrew PostgreSQL 18.6",
      "required": true
    },
    "pg10": {
      "image": "postgres:10",
      "required": true
    }
  },
  "cases": [
    {
      "id": "missing_function_resolution",
      "versions": [
        "10",
        "18"
      ],
      "preconditions": [
        "A runner-owned disposable target is provisioned."
      ],
      "trigger": "Call a schema-qualified function with an integer argument before that signature exists.",
      "assertions": [
        "SQLSTATE is 42883 and the diagnostic names the missing function signature",
        "The failed autocommit session remains IDLE",
        "Creating the exact integer signature then returns 42"
      ],
      "repair": "Check schema visibility, function/operator name, argument types, and overload resolution; create or call the intended signature rather than blindly changing search_path.",
      "cleanup": "Drop the runner schema and its function."
    }
  ],
  "evidence_status": "authored",
  "snippets": [
    {
      "id": "missing_function_resolution",
      "case_id": "missing_function_resolution",
      "language": "sql",
      "statements": {
        "trigger": "SELECT syntax_schema.missing_function(41)",
        "create": "CREATE FUNCTION syntax_schema.missing_function(integer) RETURNS integer LANGUAGE SQL AS 'SELECT $1 + 1'",
        "repair": "SELECT syntax_schema.missing_function(41)"
      }
    }
  ],
  "runtime": [
    {
      "id": "runtime.syntax2-42883-latest.latest",
      "run_id": "syntax2-42883-latest",
      "target": "latest",
      "status": "passed",
      "server_version": "18.6 (Homebrew)",
      "server_version_num": 180006,
      "summary_sha256": "cf925fb0bb74077a48829156d677b2da804f9f12307524991e293765ea70da1e",
      "raw_sha256": "05d9c68eedf0bf0cbdce86869d7037172b39f1e671883b6e1d69d95ddd882b32",
      "case_manifest": {
        "id": "manifest.42883",
        "kind": "local_artifact",
        "source_role": "case_manifest",
        "sha256": "93525c5a0711f2feb9107b0b42d678bcb93ea48221f10894788c3b27568f3178"
      },
      "snippet_registry": {
        "id": "snippet-registry.42883",
        "kind": "local_artifact",
        "source_role": "snippet_registry",
        "sha256": "9b85f7d06d85ecf0a5389f6f507c1b62bbd9c94ab183cb26c0f29d015f90cecc"
      },
      "environment": {
        "TimeZone": "Asia/Shanghai",
        "backend_pid": 29899,
        "binary": {
          "bindir": "/opt/homebrew/Cellar/postgresql@18/18.6/bin",
          "pg_config": "/opt/homebrew/bin/pg_config",
          "pg_config_version": "PostgreSQL 18.6 (Homebrew)",
          "postgres": "/opt/homebrew/Cellar/postgresql@18/18.6/bin/postgres"
        },
        "connection_scope": "runner-owned localhost port",
        "current_user": "runner",
        "docker": {},
        "lc_messages": "C",
        "libpq_version": "18.6",
        "locale": "C.UTF-8",
        "log_destination": "csvlog,jsonlog",
        "log_error_verbosity": "verbose",
        "log_min_error_statement": "error",
        "log_min_messages": "error",
        "logging_collector": "on",
        "machine": "arm64",
        "max_connections": "100",
        "platform": "macOS-26.6.2-arm64-arm-64bit-Mach-O",
        "psycopg_version": "3.3.5",
        "python_version": "3.14.6 (main, Jun 10 2026, 10:03:53) [Clang 21.0.0 (clang-2100.0.123.102)]",
        "server_encoding": "UTF8",
        "server_version": "18.6 (Homebrew)",
        "server_version_num": "180006",
        "target_kind": "latest",
        "wal_level": "logical"
      },
      "cases": [
        "missing_function_resolution"
      ],
      "observed": {
        "connection_autocommit": true,
        "diagnostic": {
          "column_name": null,
          "constraint_name": null,
          "context": null,
          "datatype_name": null,
          "exception_type": "UndefinedFunction",
          "internal_position": null,
          "internal_query": null,
          "message_detail": null,
          "message_hint": "No function matches the given name and argument types. You might need to add explicit type casts.",
          "message_primary": "function c42883_missing_function_resolution.missing_function(integer) does not exist",
          "schema_name": null,
          "severity": "ERROR",
          "severity_nonlocalized": "ERROR",
          "source_file": "parse_func.c",
          "source_function": "ParseFuncOrColumn",
          "source_line": "636",
          "sqlstate": "42883",
          "statement_position": "8",
          "table_name": null,
          "text": "function c42883_missing_function_resolution.missing_function(integer) does not exist\nLINE 1: SELECT \"c42883_missing_function_resolution\".missing_function...\n               ^\nHINT:  No function matches the given name and argument types. You might need to add explicit type casts."
        },
        "failed_status": "IDLE",
        "repair_status": "IDLE",
        "repair_value": 42
      },
      "assertions": [
        {
          "expected": "42883",
          "name": "42883 SQLSTATE",
          "observed": "42883",
          "passed": true
        },
        {
          "expected": "ERROR",
          "name": "42883 ERROR severity",
          "observed": "ERROR",
          "passed": true
        },
        {
          "expected": "missing_function(integer) does not exist",
          "name": "undefined function diagnostic includes name and signature",
          "observed": "function c42883_missing_function_resolution.missing_function(integer) does not exist",
          "passed": true
        },
        {
          "expected": "IDLE",
          "name": "undefined function leaves autocommit session usable",
          "observed": "IDLE",
          "passed": true
        },
        {
          "expected": {
            "status": "IDLE",
            "value": 42
          },
          "name": "creating the exact integer signature repairs lookup",
          "observed": {
            "error": true,
            "status": "IDLE",
            "value": 42
          },
          "passed": true
        }
      ],
      "cleanup": {
        "errors": [],
        "passed": true
      },
      "result": {
        "status": "passed",
        "environment": {
          "TimeZone": "Asia/Shanghai",
          "backend_pid": 29899,
          "binary": {
            "bindir": "/opt/homebrew/Cellar/postgresql@18/18.6/bin",
            "pg_config": "/opt/homebrew/bin/pg_config",
            "pg_config_version": "PostgreSQL 18.6 (Homebrew)",
            "postgres": "/opt/homebrew/Cellar/postgresql@18/18.6/bin/postgres"
          },
          "connection_scope": "runner-owned localhost port",
          "current_user": "runner",
          "docker": {},
          "lc_messages": "C",
          "libpq_version": "18.6",
          "locale": "C.UTF-8",
          "log_destination": "csvlog,jsonlog",
          "log_error_verbosity": "verbose",
          "log_min_error_statement": "error",
          "log_min_messages": "error",
          "logging_collector": "on",
          "machine": "arm64",
          "max_connections": "100",
          "platform": "macOS-26.6.2-arm64-arm-64bit-Mach-O",
          "psycopg_version": "3.3.5",
          "python_version": "3.14.6 (main, Jun 10 2026, 10:03:53) [Clang 21.0.0 (clang-2100.0.123.102)]",
          "server_encoding": "UTF8",
          "server_version": "18.6 (Homebrew)",
          "server_version_num": "180006",
          "target_kind": "latest",
          "wal_level": "logical"
        },
        "cases": [
          {
            "assertions": [
              {
                "expected": "42883",
                "name": "42883 SQLSTATE",
                "observed": "42883",
                "passed": true
              },
              {
                "expected": "ERROR",
                "name": "42883 ERROR severity",
                "observed": "ERROR",
                "passed": true
              },
              {
                "expected": "missing_function(integer) does not exist",
                "name": "undefined function diagnostic includes name and signature",
                "observed": "function c42883_missing_function_resolution.missing_function(integer) does not exist",
                "passed": true
              },
              {
                "expected": "IDLE",
                "name": "undefined function leaves autocommit session usable",
                "observed": "IDLE",
                "passed": true
              },
              {
                "expected": {
                  "status": "IDLE",
                  "value": 42
                },
                "name": "creating the exact integer signature repairs lookup",
                "observed": {
                  "error": true,
                  "status": "IDLE",
                  "value": 42
                },
                "passed": true
              }
            ],
            "case_id": "missing_function_resolution",
            "cleanup": {
              "errors": [],
              "passed": true
            },
            "elapsed_seconds": 0.007,
            "observed": {
              "connection_autocommit": true,
              "diagnostic": {
                "column_name": null,
                "constraint_name": null,
                "context": null,
                "datatype_name": null,
                "exception_type": "UndefinedFunction",
                "internal_position": null,
                "internal_query": null,
                "message_detail": null,
                "message_hint": "No function matches the given name and argument types. You might need to add explicit type casts.",
                "message_primary": "function c42883_missing_function_resolution.missing_function(integer) does not exist",
                "schema_name": null,
                "severity": "ERROR",
                "severity_nonlocalized": "ERROR",
                "source_file": "parse_func.c",
                "source_function": "ParseFuncOrColumn",
                "source_line": "636",
                "sqlstate": "42883",
                "statement_position": "8",
                "table_name": null,
                "text": "function c42883_missing_function_resolution.missing_function(integer) does not exist\nLINE 1: SELECT \"c42883_missing_function_resolution\".missing_function...\n               ^\nHINT:  No function matches the given name and argument types. You might need to add explicit type casts."
              },
              "failed_status": "IDLE",
              "repair_status": "IDLE",
              "repair_value": 42
            },
            "schema": "c42883_missing_function_resolution",
            "status": "passed"
          }
        ]
      }
    },
    {
      "id": "runtime.syntax2-42883-pg10.pg10",
      "run_id": "syntax2-42883-pg10",
      "target": "pg10",
      "status": "passed",
      "server_version": "10.21 (Debian 10.21-1.pgdg90+1)",
      "server_version_num": 100021,
      "summary_sha256": "9bbf9a4f3ea09105a2419552ea3d117bf5c87bd255e82b5851c60d0256b6fbcf",
      "raw_sha256": "25a6a146fe2e7f8817e7de1146163ad2a3160930ff323b2ec73c09c91ba792e3",
      "case_manifest": {
        "id": "manifest.42883",
        "kind": "local_artifact",
        "source_role": "case_manifest",
        "sha256": "93525c5a0711f2feb9107b0b42d678bcb93ea48221f10894788c3b27568f3178"
      },
      "snippet_registry": {
        "id": "snippet-registry.42883",
        "kind": "local_artifact",
        "source_role": "snippet_registry",
        "sha256": "9b85f7d06d85ecf0a5389f6f507c1b62bbd9c94ab183cb26c0f29d015f90cecc"
      },
      "environment": {
        "TimeZone": "Etc/UTC",
        "backend_pid": 79,
        "binary": {},
        "connection_scope": "runner-owned localhost port",
        "current_user": "postgres",
        "docker": {
          "architecture": "arm64",
          "command": "/usr/local/bin/docker",
          "digest": "sha256:b2baf8998630663d21370da06387c950e587071bdd307ee34e661cdcc7442bcc",
          "id": "sha256:b2baf8998630663d21370da06387c950e587071bdd307ee34e661cdcc7442bcc",
          "image": "postgres:10",
          "image_created": "2022-06-23T09:11:18.374607054Z",
          "image_ref": "postgres@sha256:b2baf8998630663d21370da06387c950e587071bdd307ee34e661cdcc7442bcc",
          "log_destination": "csvlog",
          "os": "linux",
          "repo_digests": [
            "postgres@sha256:b2baf8998630663d21370da06387c950e587071bdd307ee34e661cdcc7442bcc"
          ]
        },
        "lc_messages": "en_US.utf8",
        "libpq_version": "18.6",
        "locale": "C.UTF-8",
        "log_destination": "csvlog",
        "log_error_verbosity": "verbose",
        "log_min_error_statement": "error",
        "log_min_messages": "error",
        "logging_collector": "on",
        "machine": "arm64",
        "max_connections": "100",
        "platform": "macOS-26.6.2-arm64-arm-64bit-Mach-O",
        "psycopg_version": "3.3.5",
        "python_version": "3.14.6 (main, Jun 10 2026, 10:03:53) [Clang 21.0.0 (clang-2100.0.123.102)]",
        "server_encoding": "UTF8",
        "server_version": "10.21 (Debian 10.21-1.pgdg90+1)",
        "server_version_num": "100021",
        "target_kind": "pg10",
        "wal_level": "logical"
      },
      "cases": [
        "missing_function_resolution"
      ],
      "observed": {
        "connection_autocommit": true,
        "diagnostic": {
          "column_name": null,
          "constraint_name": null,
          "context": null,
          "datatype_name": null,
          "exception_type": "UndefinedFunction",
          "internal_position": null,
          "internal_query": null,
          "message_detail": null,
          "message_hint": "No function matches the given name and argument types. You might need to add explicit type casts.",
          "message_primary": "function c42883_missing_function_resolution.missing_function(integer) does not exist",
          "schema_name": null,
          "severity": "ERROR",
          "severity_nonlocalized": "ERROR",
          "source_file": "parse_func.c",
          "source_function": "ParseFuncOrColumn",
          "source_line": "528",
          "sqlstate": "42883",
          "statement_position": "8",
          "table_name": null,
          "text": "function c42883_missing_function_resolution.missing_function(integer) does not exist\nLINE 1: SELECT \"c42883_missing_function_resolution\".missing_function...\n               ^\nHINT:  No function matches the given name and argument types. You might need to add explicit type casts."
        },
        "failed_status": "IDLE",
        "repair_status": "IDLE",
        "repair_value": 42
      },
      "assertions": [
        {
          "expected": "42883",
          "name": "42883 SQLSTATE",
          "observed": "42883",
          "passed": true
        },
        {
          "expected": "ERROR",
          "name": "42883 ERROR severity",
          "observed": "ERROR",
          "passed": true
        },
        {
          "expected": "missing_function(integer) does not exist",
          "name": "undefined function diagnostic includes name and signature",
          "observed": "function c42883_missing_function_resolution.missing_function(integer) does not exist",
          "passed": true
        },
        {
          "expected": "IDLE",
          "name": "undefined function leaves autocommit session usable",
          "observed": "IDLE",
          "passed": true
        },
        {
          "expected": {
            "status": "IDLE",
            "value": 42
          },
          "name": "creating the exact integer signature repairs lookup",
          "observed": {
            "error": true,
            "status": "IDLE",
            "value": 42
          },
          "passed": true
        }
      ],
      "cleanup": {
        "errors": [],
        "passed": true
      },
      "result": {
        "status": "passed",
        "environment": {
          "TimeZone": "Etc/UTC",
          "backend_pid": 79,
          "binary": {},
          "connection_scope": "runner-owned localhost port",
          "current_user": "postgres",
          "docker": {
            "architecture": "arm64",
            "command": "/usr/local/bin/docker",
            "digest": "sha256:b2baf8998630663d21370da06387c950e587071bdd307ee34e661cdcc7442bcc",
            "id": "sha256:b2baf8998630663d21370da06387c950e587071bdd307ee34e661cdcc7442bcc",
            "image": "postgres:10",
            "image_created": "2022-06-23T09:11:18.374607054Z",
            "image_ref": "postgres@sha256:b2baf8998630663d21370da06387c950e587071bdd307ee34e661cdcc7442bcc",
            "log_destination": "csvlog",
            "os": "linux",
            "repo_digests": [
              "postgres@sha256:b2baf8998630663d21370da06387c950e587071bdd307ee34e661cdcc7442bcc"
            ]
          },
          "lc_messages": "en_US.utf8",
          "libpq_version": "18.6",
          "locale": "C.UTF-8",
          "log_destination": "csvlog",
          "log_error_verbosity": "verbose",
          "log_min_error_statement": "error",
          "log_min_messages": "error",
          "logging_collector": "on",
          "machine": "arm64",
          "max_connections": "100",
          "platform": "macOS-26.6.2-arm64-arm-64bit-Mach-O",
          "psycopg_version": "3.3.5",
          "python_version": "3.14.6 (main, Jun 10 2026, 10:03:53) [Clang 21.0.0 (clang-2100.0.123.102)]",
          "server_encoding": "UTF8",
          "server_version": "10.21 (Debian 10.21-1.pgdg90+1)",
          "server_version_num": "100021",
          "target_kind": "pg10",
          "wal_level": "logical"
        },
        "cases": [
          {
            "assertions": [
              {
                "expected": "42883",
                "name": "42883 SQLSTATE",
                "observed": "42883",
                "passed": true
              },
              {
                "expected": "ERROR",
                "name": "42883 ERROR severity",
                "observed": "ERROR",
                "passed": true
              },
              {
                "expected": "missing_function(integer) does not exist",
                "name": "undefined function diagnostic includes name and signature",
                "observed": "function c42883_missing_function_resolution.missing_function(integer) does not exist",
                "passed": true
              },
              {
                "expected": "IDLE",
                "name": "undefined function leaves autocommit session usable",
                "observed": "IDLE",
                "passed": true
              },
              {
                "expected": {
                  "status": "IDLE",
                  "value": 42
                },
                "name": "creating the exact integer signature repairs lookup",
                "observed": {
                  "error": true,
                  "status": "IDLE",
                  "value": 42
                },
                "passed": true
              }
            ],
            "case_id": "missing_function_resolution",
            "cleanup": {
              "errors": [],
              "passed": true
            },
            "elapsed_seconds": 0.017,
            "observed": {
              "connection_autocommit": true,
              "diagnostic": {
                "column_name": null,
                "constraint_name": null,
                "context": null,
                "datatype_name": null,
                "exception_type": "UndefinedFunction",
                "internal_position": null,
                "internal_query": null,
                "message_detail": null,
                "message_hint": "No function matches the given name and argument types. You might need to add explicit type casts.",
                "message_primary": "function c42883_missing_function_resolution.missing_function(integer) does not exist",
                "schema_name": null,
                "severity": "ERROR",
                "severity_nonlocalized": "ERROR",
                "source_file": "parse_func.c",
                "source_function": "ParseFuncOrColumn",
                "source_line": "528",
                "sqlstate": "42883",
                "statement_position": "8",
                "table_name": null,
                "text": "function c42883_missing_function_resolution.missing_function(integer) does not exist\nLINE 1: SELECT \"c42883_missing_function_resolution\".missing_function...\n               ^\nHINT:  No function matches the given name and argument types. You might need to add explicit type casts."
              },
              "failed_status": "IDLE",
              "repair_status": "IDLE",
              "repair_value": 42
            },
            "schema": "c42883_missing_function_resolution",
            "status": "passed"
          }
        ]
      }
    }
  ]
}
