> ## Documentation Index
> Fetch the complete documentation index at: https://private-7c7dfe99-mintlify-86180b7b.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

> 包含用户自定义函数（UDF）的加载状态和配置元数据的系统表。

# system.user_defined_functions

<div id="description">
  ## 描述
</div>

包含[用户自定义函数 (UDF) ](/zh/reference/functions/regular-functions/udf)的加载状态、错误信息和配置元数据。

<div id="columns">
  ## 列
</div>

* `name` ([String](/zh/reference/data-types)) — UDF 名称。
* `load_status` ([Enum8('Success' = 0, 'Failed' = 1)](/zh/reference/data-types)) — 加载状态。可能的值：
  * **Success** — UDF 已加载并可使用
  * **Failed** — UDF 加载失败 (详见字段 'loading\_error\_message') 。
* `loading_error_message` ([String](/zh/reference/data-types)) — 加载失败时的详细错误信息。加载成功时为空。
* `last_successful_update_time` ([Nullable(DateTime)](/zh/reference/data-types)) — 上次成功更新的时间戳。如果从未成功，则为 NULL。
* `loading_duration_ms` ([UInt64](/zh/reference/data-types)) — 加载 UDF 的耗时，单位为毫秒。
* `type` ([Enum8('executable' = 0, 'executable\_pool' = 1)](/zh/reference/data-types)) — UDF 类型：'executable' (单进程) 或 'executable\_pool' (进程池) 。
* `command` ([String](/zh/reference/data-types)) — 为此 UDF 执行的脚本或命令。
* `format` ([String](/zh/reference/data-types)) — I/O 的数据格式 (例如 'TabSeparated'、'JSONEachRow') 。
* `return_type` ([String](/zh/reference/data-types)) — 函数返回类型 (例如 'String'、'UInt64') 。
* `return_name` ([String](/zh/reference/data-types)) — 可选的返回值标识符。未配置时为空。
* `argument_types` ([Array(String)](/zh/reference/data-types)) — 参数类型数组 (例如 \['String', 'UInt64']) 。
* `argument_names` ([Array(String)](/zh/reference/data-types)) — 参数名称数组。未命名参数对应空字符串。
* `max_command_execution_time` ([UInt64](/zh/reference/data-types)) — 处理一个数据块的最长时间 (秒) 。仅适用于 'executable\_pool' 类型。
* `command_termination_timeout` ([UInt64](/zh/reference/data-types)) — 向命令进程发送 SIGTERM 前的等待秒数。
* `command_read_timeout` ([UInt64](/zh/reference/data-types)) — 从命令 stdout 读取的超时时间 (毫秒) 。
* `command_write_timeout` ([UInt64](/zh/reference/data-types)) — 向命令 stdin 写入的超时时间 (毫秒) 。
* `pool_size` ([UInt64](/zh/reference/data-types)) — 命令进程实例数。仅适用于 'executable\_pool' 类型。
* `send_chunk_header` ([UInt8](/zh/reference/data-types)) — 是否在每个数据分块前发送行数 (布尔值) 。
* `execute_direct` ([UInt8](/zh/reference/data-types)) — 是否直接执行命令 (1) ，还是通过 /bin/bash 执行 (0) 。
* `lifetime` ([UInt64](/zh/reference/data-types)) — 重新加载间隔 (秒) 。0 表示禁用重新加载。
* `deterministic` ([UInt8](/zh/reference/data-types)) — 函数是否会对相同参数返回相同结果 (布尔值) 。

<div id="example">
  ## 示例
</div>

查看所有 UDF 及其加载状态：

```sql theme={null}
SELECT
    name,
    load_status,
    type,
    command,
    return_type,
    argument_types
FROM system.user_defined_functions
FORMAT Vertical;
```

```response theme={null}
Row 1:
──────
name:           my_sum_udf
load_status:    Success
type:           executable
command:        /var/lib/clickhouse/user_scripts/sum.py
return_type:    UInt64
argument_types: ['UInt64','UInt64']
```

查找失败的 UDF：

```sql theme={null}
SELECT
    name,
    loading_error_message
FROM system.user_defined_functions
WHERE load_status = 'Failed';
```

<div id="see-also">
  ## 另请参阅
</div>

* [用户自定义函数](/zh/reference/functions/regular-functions/udf) — 如何创建和配置 UDF。
