{
  "schema": 1,
  "sqlstate": "42723",
  "condition_name": "duplicate_function",
  "runner": "scripts/verify_cases.py",
  "targets": {
    "latest": {
      "binary": "Homebrew PostgreSQL 18.6",
      "required": true
    },
    "pg10": {
      "image": "postgres:10",
      "required": true
    }
  },
  "cases": [
    {
      "id": "duplicate_function_signature",
      "versions": [
        "10",
        "18"
      ],
      "preconditions": [
        "A runner-owned disposable target is provisioned."
      ],
      "trigger": "Create a function and repeat the same name and integer argument signature.",
      "assertions": [
        "SQLSTATE is 42723 with the same-argument-types message",
        "The failed autocommit session remains IDLE",
        "CREATE OR REPLACE with the intentional same signature returns the repaired value"
      ],
      "repair": "Choose a new signature or use CREATE OR REPLACE only when replacing the owned function is intentional.",
      "cleanup": "Drop the runner schema and its functions."
    }
  ],
  "evidence_status": "authored",
  "snippets": [
    {
      "id": "duplicate_function_signature",
      "case_id": "duplicate_function_signature",
      "language": "sql",
      "statements": {
        "create": "CREATE FUNCTION syntax_schema.duplicate_function(integer) RETURNS integer LANGUAGE SQL AS 'SELECT $1'",
        "trigger": "CREATE FUNCTION syntax_schema.duplicate_function(integer) RETURNS integer LANGUAGE SQL AS 'SELECT $1'",
        "repair": "CREATE OR REPLACE FUNCTION syntax_schema.duplicate_function(integer) RETURNS integer LANGUAGE SQL AS 'SELECT $1 + 1'",
        "verify": "SELECT syntax_schema.duplicate_function(1)"
      }
    }
  ],
  "runtime": [
    {
      "id": "runtime.syntax2-42723-latest.latest",
      "run_id": "syntax2-42723-latest",
      "target": "latest",
      "status": "passed",
      "server_version": "18.6 (Homebrew)",
      "server_version_num": 180006,
      "summary_sha256": "b0d0246767ba1f0ef3ac9c35b16e908cd13627567eb1f3ac2e2c4bdf0ea0eda9",
      "raw_sha256": "cb8cc88353fd5c3eec51177ac9d4e9cab389dc4fcb47fda8429a3bb9218374a0",
      "case_manifest": {
        "id": "manifest.42723",
        "kind": "local_artifact",
        "source_role": "case_manifest",
        "sha256": "471edc7e2643bd2acbba687dacca1bb43c1cd0c88b38f4f1dc3cfc6f874c955b"
      },
      "snippet_registry": {
        "id": "snippet-registry.42723",
        "kind": "local_artifact",
        "source_role": "snippet_registry",
        "sha256": "72806aaccc6a475009c12f9618ebf097b3304e0d8aa990c4a28193846600d7f4"
      },
      "environment": {
        "TimeZone": "Asia/Shanghai",
        "backend_pid": 30019,
        "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": [
        "duplicate_function_signature"
      ],
      "observed": {
        "connection_autocommit": true,
        "diagnostic": {
          "column_name": null,
          "constraint_name": null,
          "context": null,
          "datatype_name": null,
          "exception_type": "DuplicateFunction",
          "internal_position": null,
          "internal_query": null,
          "message_detail": null,
          "message_hint": null,
          "message_primary": "function \"duplicate_function\" already exists with same argument types",
          "schema_name": null,
          "severity": "ERROR",
          "severity_nonlocalized": "ERROR",
          "source_file": "pg_proc.c",
          "source_function": "ProcedureCreate",
          "source_line": "403",
          "sqlstate": "42723",
          "statement_position": null,
          "table_name": null,
          "text": "function \"duplicate_function\" already exists with same argument types"
        },
        "failed_status": "IDLE",
        "repair_status": "IDLE",
        "repair_value": 2
      },
      "assertions": [
        {
          "expected": "42723",
          "name": "42723 SQLSTATE",
          "observed": "42723",
          "passed": true
        },
        {
          "expected": "ERROR",
          "name": "42723 ERROR severity",
          "observed": "ERROR",
          "passed": true
        },
        {
          "expected": "function \"duplicate_function\" already exists with same argument types",
          "name": "42723 primary diagnostic",
          "observed": "function \"duplicate_function\" already exists with same argument types",
          "passed": true
        },
        {
          "expected": "IDLE",
          "name": "duplicate function leaves autocommit session usable",
          "observed": "IDLE",
          "passed": true
        },
        {
          "expected": {
            "status": "IDLE",
            "value": 2
          },
          "name": "same signature can be intentionally replaced",
          "observed": {
            "error": true,
            "status": "IDLE",
            "value": 2
          },
          "passed": true
        }
      ],
      "cleanup": {
        "errors": [],
        "passed": true
      },
      "result": {
        "status": "passed",
        "environment": {
          "TimeZone": "Asia/Shanghai",
          "backend_pid": 30019,
          "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": "42723",
                "name": "42723 SQLSTATE",
                "observed": "42723",
                "passed": true
              },
              {
                "expected": "ERROR",
                "name": "42723 ERROR severity",
                "observed": "ERROR",
                "passed": true
              },
              {
                "expected": "function \"duplicate_function\" already exists with same argument types",
                "name": "42723 primary diagnostic",
                "observed": "function \"duplicate_function\" already exists with same argument types",
                "passed": true
              },
              {
                "expected": "IDLE",
                "name": "duplicate function leaves autocommit session usable",
                "observed": "IDLE",
                "passed": true
              },
              {
                "expected": {
                  "status": "IDLE",
                  "value": 2
                },
                "name": "same signature can be intentionally replaced",
                "observed": {
                  "error": true,
                  "status": "IDLE",
                  "value": 2
                },
                "passed": true
              }
            ],
            "case_id": "duplicate_function_signature",
            "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": "DuplicateFunction",
                "internal_position": null,
                "internal_query": null,
                "message_detail": null,
                "message_hint": null,
                "message_primary": "function \"duplicate_function\" already exists with same argument types",
                "schema_name": null,
                "severity": "ERROR",
                "severity_nonlocalized": "ERROR",
                "source_file": "pg_proc.c",
                "source_function": "ProcedureCreate",
                "source_line": "403",
                "sqlstate": "42723",
                "statement_position": null,
                "table_name": null,
                "text": "function \"duplicate_function\" already exists with same argument types"
              },
              "failed_status": "IDLE",
              "repair_status": "IDLE",
              "repair_value": 2
            },
            "schema": "c42723_duplicate_function_signature",
            "status": "passed"
          }
        ]
      }
    },
    {
      "id": "runtime.syntax2-42723-pg10.pg10",
      "run_id": "syntax2-42723-pg10",
      "target": "pg10",
      "status": "passed",
      "server_version": "10.21 (Debian 10.21-1.pgdg90+1)",
      "server_version_num": 100021,
      "summary_sha256": "e1c96a32180dda5bcbabd08aa2dca35d2d0b1d74e235c4d1ef9497f7963bbd13",
      "raw_sha256": "22ac7673c3fb470961fac05bd26312eb4ab1f348dcbff351889b199f2ee42e17",
      "case_manifest": {
        "id": "manifest.42723",
        "kind": "local_artifact",
        "source_role": "case_manifest",
        "sha256": "471edc7e2643bd2acbba687dacca1bb43c1cd0c88b38f4f1dc3cfc6f874c955b"
      },
      "snippet_registry": {
        "id": "snippet-registry.42723",
        "kind": "local_artifact",
        "source_role": "snippet_registry",
        "sha256": "72806aaccc6a475009c12f9618ebf097b3304e0d8aa990c4a28193846600d7f4"
      },
      "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": [
        "duplicate_function_signature"
      ],
      "observed": {
        "connection_autocommit": true,
        "diagnostic": {
          "column_name": null,
          "constraint_name": null,
          "context": null,
          "datatype_name": null,
          "exception_type": "DuplicateFunction",
          "internal_position": null,
          "internal_query": null,
          "message_detail": null,
          "message_hint": null,
          "message_primary": "function \"duplicate_function\" already exists with same argument types",
          "schema_name": null,
          "severity": "ERROR",
          "severity_nonlocalized": "ERROR",
          "source_file": "pg_proc.c",
          "source_function": "ProcedureCreate",
          "source_line": "401",
          "sqlstate": "42723",
          "statement_position": null,
          "table_name": null,
          "text": "function \"duplicate_function\" already exists with same argument types"
        },
        "failed_status": "IDLE",
        "repair_status": "IDLE",
        "repair_value": 2
      },
      "assertions": [
        {
          "expected": "42723",
          "name": "42723 SQLSTATE",
          "observed": "42723",
          "passed": true
        },
        {
          "expected": "ERROR",
          "name": "42723 ERROR severity",
          "observed": "ERROR",
          "passed": true
        },
        {
          "expected": "function \"duplicate_function\" already exists with same argument types",
          "name": "42723 primary diagnostic",
          "observed": "function \"duplicate_function\" already exists with same argument types",
          "passed": true
        },
        {
          "expected": "IDLE",
          "name": "duplicate function leaves autocommit session usable",
          "observed": "IDLE",
          "passed": true
        },
        {
          "expected": {
            "status": "IDLE",
            "value": 2
          },
          "name": "same signature can be intentionally replaced",
          "observed": {
            "error": true,
            "status": "IDLE",
            "value": 2
          },
          "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": "42723",
                "name": "42723 SQLSTATE",
                "observed": "42723",
                "passed": true
              },
              {
                "expected": "ERROR",
                "name": "42723 ERROR severity",
                "observed": "ERROR",
                "passed": true
              },
              {
                "expected": "function \"duplicate_function\" already exists with same argument types",
                "name": "42723 primary diagnostic",
                "observed": "function \"duplicate_function\" already exists with same argument types",
                "passed": true
              },
              {
                "expected": "IDLE",
                "name": "duplicate function leaves autocommit session usable",
                "observed": "IDLE",
                "passed": true
              },
              {
                "expected": {
                  "status": "IDLE",
                  "value": 2
                },
                "name": "same signature can be intentionally replaced",
                "observed": {
                  "error": true,
                  "status": "IDLE",
                  "value": 2
                },
                "passed": true
              }
            ],
            "case_id": "duplicate_function_signature",
            "cleanup": {
              "errors": [],
              "passed": true
            },
            "elapsed_seconds": 0.013,
            "observed": {
              "connection_autocommit": true,
              "diagnostic": {
                "column_name": null,
                "constraint_name": null,
                "context": null,
                "datatype_name": null,
                "exception_type": "DuplicateFunction",
                "internal_position": null,
                "internal_query": null,
                "message_detail": null,
                "message_hint": null,
                "message_primary": "function \"duplicate_function\" already exists with same argument types",
                "schema_name": null,
                "severity": "ERROR",
                "severity_nonlocalized": "ERROR",
                "source_file": "pg_proc.c",
                "source_function": "ProcedureCreate",
                "source_line": "401",
                "sqlstate": "42723",
                "statement_position": null,
                "table_name": null,
                "text": "function \"duplicate_function\" already exists with same argument types"
              },
              "failed_status": "IDLE",
              "repair_status": "IDLE",
              "repair_value": 2
            },
            "schema": "c42723_duplicate_function_signature",
            "status": "passed"
          }
        ]
      }
    }
  ]
}
