{
  "schema": 1,
  "sqlstate": "42725",
  "condition_name": "ambiguous_function",
  "runner": "scripts/verify_cases.py",
  "targets": {
    "latest": {
      "binary": "Homebrew PostgreSQL 18.6",
      "required": true
    },
    "pg10": {
      "image": "postgres:10",
      "required": true
    }
  },
  "cases": [
    {
      "id": "ambiguous_function_call",
      "versions": [
        "10",
        "18"
      ],
      "preconditions": [
        "A runner-owned disposable target is provisioned."
      ],
      "trigger": "Call two uuid/jsonb overloads with an unknown string literal.",
      "assertions": [
        "SQLSTATE is 42725 and the diagnostic identifies ambiguous_function(unknown)",
        "The hint requests explicit type casts and the session remains IDLE",
        "An explicit uuid cast selects the intended overload"
      ],
      "repair": "Cast the input to the intended type or remove the overload ambiguity; do not guess from a function name alone.",
      "cleanup": "Drop the runner schema and its overloads."
    }
  ],
  "evidence_status": "authored",
  "snippets": [
    {
      "id": "ambiguous_function_call",
      "case_id": "ambiguous_function_call",
      "language": "sql",
      "statements": {
        "create_uuid": "CREATE FUNCTION syntax_schema.ambiguous_function(uuid) RETURNS text LANGUAGE SQL AS 'SELECT ''uuid'''",
        "create_jsonb": "CREATE FUNCTION syntax_schema.ambiguous_function(jsonb) RETURNS text LANGUAGE SQL AS 'SELECT ''jsonb'''",
        "trigger": "SELECT syntax_schema.ambiguous_function('123e4567-e89b-12d3-a456-426614174000')",
        "repair": "SELECT syntax_schema.ambiguous_function('123e4567-e89b-12d3-a456-426614174000'::uuid)"
      }
    }
  ],
  "runtime": [
    {
      "id": "runtime.syntax2-42725-latest.latest",
      "run_id": "syntax2-42725-latest",
      "target": "latest",
      "status": "passed",
      "server_version": "18.6 (Homebrew)",
      "server_version_num": 180006,
      "summary_sha256": "7eb983d101b26523ccf85e3f7522493a616cefa46476754f66cd9286b503bc83",
      "raw_sha256": "aae6af67eb1179d5ff825e266a25ff9fbed2d984150a88761130d6519d3e25d9",
      "case_manifest": {
        "id": "manifest.42725",
        "kind": "local_artifact",
        "source_role": "case_manifest",
        "sha256": "f30aa7905019f99f891ca5dfd53a4c5439f5d363ac7ba6f21cca51decfa78608"
      },
      "snippet_registry": {
        "id": "snippet-registry.42725",
        "kind": "local_artifact",
        "source_role": "snippet_registry",
        "sha256": "12b590e1d121cc121cf707657e48cbf4a07cbe63cce30780fc3c05043c3a892d"
      },
      "environment": {
        "TimeZone": "Asia/Shanghai",
        "backend_pid": 30059,
        "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": [
        "ambiguous_function_call"
      ],
      "observed": {
        "connection_autocommit": true,
        "diagnostic": {
          "column_name": null,
          "constraint_name": null,
          "context": null,
          "datatype_name": null,
          "exception_type": "AmbiguousFunction",
          "internal_position": null,
          "internal_query": null,
          "message_detail": null,
          "message_hint": "Could not choose a best candidate function. You might need to add explicit type casts.",
          "message_primary": "function c42725_ambiguous_function_call.ambiguous_function(unknown) is not unique",
          "schema_name": null,
          "severity": "ERROR",
          "severity_nonlocalized": "ERROR",
          "source_file": "parse_func.c",
          "source_function": "ParseFuncOrColumn",
          "source_line": "577",
          "sqlstate": "42725",
          "statement_position": "8",
          "table_name": null,
          "text": "function c42725_ambiguous_function_call.ambiguous_function(unknown) is not unique\nLINE 1: SELECT \"c42725_ambiguous_function_call\".ambiguous_function('...\n               ^\nHINT:  Could not choose a best candidate function. You might need to add explicit type casts."
        },
        "failed_status": "IDLE",
        "repair_status": "IDLE",
        "repair_value": "uuid"
      },
      "assertions": [
        {
          "expected": "42725",
          "name": "42725 SQLSTATE",
          "observed": "42725",
          "passed": true
        },
        {
          "expected": "ERROR",
          "name": "42725 ERROR severity",
          "observed": "ERROR",
          "passed": true
        },
        {
          "expected": "ambiguous_function(unknown) is not unique",
          "name": "ambiguous function diagnostic names the unresolved signature",
          "observed": "function c42725_ambiguous_function_call.ambiguous_function(unknown) is not unique",
          "passed": true
        },
        {
          "expected": "IDLE",
          "name": "ambiguous function leaves autocommit session usable",
          "observed": "IDLE",
          "passed": true
        },
        {
          "expected": "Could not choose a best candidate function. You might need to add explicit type casts.",
          "name": "parser hint recommends explicit type casts",
          "observed": "Could not choose a best candidate function. You might need to add explicit type casts.",
          "passed": true
        },
        {
          "expected": {
            "status": "IDLE",
            "value": "uuid"
          },
          "name": "explicit uuid cast selects one overload",
          "observed": {
            "error": true,
            "status": "IDLE",
            "value": "uuid"
          },
          "passed": true
        }
      ],
      "cleanup": {
        "errors": [],
        "passed": true
      },
      "result": {
        "status": "passed",
        "environment": {
          "TimeZone": "Asia/Shanghai",
          "backend_pid": 30059,
          "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": "42725",
                "name": "42725 SQLSTATE",
                "observed": "42725",
                "passed": true
              },
              {
                "expected": "ERROR",
                "name": "42725 ERROR severity",
                "observed": "ERROR",
                "passed": true
              },
              {
                "expected": "ambiguous_function(unknown) is not unique",
                "name": "ambiguous function diagnostic names the unresolved signature",
                "observed": "function c42725_ambiguous_function_call.ambiguous_function(unknown) is not unique",
                "passed": true
              },
              {
                "expected": "IDLE",
                "name": "ambiguous function leaves autocommit session usable",
                "observed": "IDLE",
                "passed": true
              },
              {
                "expected": "Could not choose a best candidate function. You might need to add explicit type casts.",
                "name": "parser hint recommends explicit type casts",
                "observed": "Could not choose a best candidate function. You might need to add explicit type casts.",
                "passed": true
              },
              {
                "expected": {
                  "status": "IDLE",
                  "value": "uuid"
                },
                "name": "explicit uuid cast selects one overload",
                "observed": {
                  "error": true,
                  "status": "IDLE",
                  "value": "uuid"
                },
                "passed": true
              }
            ],
            "case_id": "ambiguous_function_call",
            "cleanup": {
              "errors": [],
              "passed": true
            },
            "elapsed_seconds": 0.008,
            "observed": {
              "connection_autocommit": true,
              "diagnostic": {
                "column_name": null,
                "constraint_name": null,
                "context": null,
                "datatype_name": null,
                "exception_type": "AmbiguousFunction",
                "internal_position": null,
                "internal_query": null,
                "message_detail": null,
                "message_hint": "Could not choose a best candidate function. You might need to add explicit type casts.",
                "message_primary": "function c42725_ambiguous_function_call.ambiguous_function(unknown) is not unique",
                "schema_name": null,
                "severity": "ERROR",
                "severity_nonlocalized": "ERROR",
                "source_file": "parse_func.c",
                "source_function": "ParseFuncOrColumn",
                "source_line": "577",
                "sqlstate": "42725",
                "statement_position": "8",
                "table_name": null,
                "text": "function c42725_ambiguous_function_call.ambiguous_function(unknown) is not unique\nLINE 1: SELECT \"c42725_ambiguous_function_call\".ambiguous_function('...\n               ^\nHINT:  Could not choose a best candidate function. You might need to add explicit type casts."
              },
              "failed_status": "IDLE",
              "repair_status": "IDLE",
              "repair_value": "uuid"
            },
            "schema": "c42725_ambiguous_function_call",
            "status": "passed"
          }
        ]
      }
    },
    {
      "id": "runtime.syntax2-42725-pg10.pg10",
      "run_id": "syntax2-42725-pg10",
      "target": "pg10",
      "status": "passed",
      "server_version": "10.21 (Debian 10.21-1.pgdg90+1)",
      "server_version_num": 100021,
      "summary_sha256": "fd06bb75895662d5ff912d53d42ece8e73a183c5722d9aaf74a48c69d2fe1482",
      "raw_sha256": "3c040a2678f73c59608904f5ec16e4e4724eabb2d889d95771399e66d97d5dcc",
      "case_manifest": {
        "id": "manifest.42725",
        "kind": "local_artifact",
        "source_role": "case_manifest",
        "sha256": "f30aa7905019f99f891ca5dfd53a4c5439f5d363ac7ba6f21cca51decfa78608"
      },
      "snippet_registry": {
        "id": "snippet-registry.42725",
        "kind": "local_artifact",
        "source_role": "snippet_registry",
        "sha256": "12b590e1d121cc121cf707657e48cbf4a07cbe63cce30780fc3c05043c3a892d"
      },
      "environment": {
        "TimeZone": "Etc/UTC",
        "backend_pid": 80,
        "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": [
        "ambiguous_function_call"
      ],
      "observed": {
        "connection_autocommit": true,
        "diagnostic": {
          "column_name": null,
          "constraint_name": null,
          "context": null,
          "datatype_name": null,
          "exception_type": "AmbiguousFunction",
          "internal_position": null,
          "internal_query": null,
          "message_detail": null,
          "message_hint": "Could not choose a best candidate function. You might need to add explicit type casts.",
          "message_primary": "function c42725_ambiguous_function_call.ambiguous_function(unknown) is not unique",
          "schema_name": null,
          "severity": "ERROR",
          "severity_nonlocalized": "ERROR",
          "source_file": "parse_func.c",
          "source_function": "ParseFuncOrColumn",
          "source_line": "506",
          "sqlstate": "42725",
          "statement_position": "8",
          "table_name": null,
          "text": "function c42725_ambiguous_function_call.ambiguous_function(unknown) is not unique\nLINE 1: SELECT \"c42725_ambiguous_function_call\".ambiguous_function('...\n               ^\nHINT:  Could not choose a best candidate function. You might need to add explicit type casts."
        },
        "failed_status": "IDLE",
        "repair_status": "IDLE",
        "repair_value": "uuid"
      },
      "assertions": [
        {
          "expected": "42725",
          "name": "42725 SQLSTATE",
          "observed": "42725",
          "passed": true
        },
        {
          "expected": "ERROR",
          "name": "42725 ERROR severity",
          "observed": "ERROR",
          "passed": true
        },
        {
          "expected": "ambiguous_function(unknown) is not unique",
          "name": "ambiguous function diagnostic names the unresolved signature",
          "observed": "function c42725_ambiguous_function_call.ambiguous_function(unknown) is not unique",
          "passed": true
        },
        {
          "expected": "IDLE",
          "name": "ambiguous function leaves autocommit session usable",
          "observed": "IDLE",
          "passed": true
        },
        {
          "expected": "Could not choose a best candidate function. You might need to add explicit type casts.",
          "name": "parser hint recommends explicit type casts",
          "observed": "Could not choose a best candidate function. You might need to add explicit type casts.",
          "passed": true
        },
        {
          "expected": {
            "status": "IDLE",
            "value": "uuid"
          },
          "name": "explicit uuid cast selects one overload",
          "observed": {
            "error": true,
            "status": "IDLE",
            "value": "uuid"
          },
          "passed": true
        }
      ],
      "cleanup": {
        "errors": [],
        "passed": true
      },
      "result": {
        "status": "passed",
        "environment": {
          "TimeZone": "Etc/UTC",
          "backend_pid": 80,
          "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": "42725",
                "name": "42725 SQLSTATE",
                "observed": "42725",
                "passed": true
              },
              {
                "expected": "ERROR",
                "name": "42725 ERROR severity",
                "observed": "ERROR",
                "passed": true
              },
              {
                "expected": "ambiguous_function(unknown) is not unique",
                "name": "ambiguous function diagnostic names the unresolved signature",
                "observed": "function c42725_ambiguous_function_call.ambiguous_function(unknown) is not unique",
                "passed": true
              },
              {
                "expected": "IDLE",
                "name": "ambiguous function leaves autocommit session usable",
                "observed": "IDLE",
                "passed": true
              },
              {
                "expected": "Could not choose a best candidate function. You might need to add explicit type casts.",
                "name": "parser hint recommends explicit type casts",
                "observed": "Could not choose a best candidate function. You might need to add explicit type casts.",
                "passed": true
              },
              {
                "expected": {
                  "status": "IDLE",
                  "value": "uuid"
                },
                "name": "explicit uuid cast selects one overload",
                "observed": {
                  "error": true,
                  "status": "IDLE",
                  "value": "uuid"
                },
                "passed": true
              }
            ],
            "case_id": "ambiguous_function_call",
            "cleanup": {
              "errors": [],
              "passed": true
            },
            "elapsed_seconds": 0.015,
            "observed": {
              "connection_autocommit": true,
              "diagnostic": {
                "column_name": null,
                "constraint_name": null,
                "context": null,
                "datatype_name": null,
                "exception_type": "AmbiguousFunction",
                "internal_position": null,
                "internal_query": null,
                "message_detail": null,
                "message_hint": "Could not choose a best candidate function. You might need to add explicit type casts.",
                "message_primary": "function c42725_ambiguous_function_call.ambiguous_function(unknown) is not unique",
                "schema_name": null,
                "severity": "ERROR",
                "severity_nonlocalized": "ERROR",
                "source_file": "parse_func.c",
                "source_function": "ParseFuncOrColumn",
                "source_line": "506",
                "sqlstate": "42725",
                "statement_position": "8",
                "table_name": null,
                "text": "function c42725_ambiguous_function_call.ambiguous_function(unknown) is not unique\nLINE 1: SELECT \"c42725_ambiguous_function_call\".ambiguous_function('...\n               ^\nHINT:  Could not choose a best candidate function. You might need to add explicit type casts."
              },
              "failed_status": "IDLE",
              "repair_status": "IDLE",
              "repair_value": "uuid"
            },
            "schema": "c42725_ambiguous_function_call",
            "status": "passed"
          }
        ]
      }
    }
  ]
}
