

 从补丁 198 开始，Amazon Redshift 将不再支持创建新的 Python UDF。现有的 Python UDF 将继续正常运行至 2026 年 6 月 30 日。有关更多信息，请参阅[博客文章](https://www.amazonaws.cn/blogs/big-data/amazon-redshift-python-user-defined-functions-will-reach-end-of-support-after-june-30-2026/)。

# SYS\_LOAD\_ERROR\_DETAIL
<a name="SYS_LOAD_ERROR_DETAIL"></a>

使用 SYS\_LOAD\_ERROR\_DETAIL 查看 COPY 命令错误的详细信息。每行代表一个 COPY 命令。它包含正在运行和已完成的 COPY 命令。

SYS\_LOAD\_ERROR\_DETAIL 对所有用户可见。超级用户可以查看所有行；普通用户只能查看其自己的数据。有关更多信息，请参阅 [系统表和视图中的数据可见性](cm_chap_system-tables.md#c_visibility-of-data)。

## 表列
<a name="SYS_LOAD_ERROR_DETAIL-table-columns"></a>


| 列名称  | 数据类型  | 描述  | 
| --- | --- | --- | 
| user\_id | integer | 提交副本用户的标识符。 | 
| query\_id | bigint | 副本的查询标识符。 | 
| transaction\_id | bigint | 事务标识符。 | 
| session\_id | integer | 运行副本的进程的进程标识符。 | 
| database\_name | character(64) | 发起复制时用户连接到其中的数据库的名称。 | 
| table\_id | integer | 表标识符。 | 
| start\_time | timestamp | 复制开始的时间 (UTC)。 | 
| file\_name | character(256) | 要加载的输入文件的完整路径。 | 
| line\_number | bigint | 加载文件中出现错误的行号。加载 JSON 文件时，包含错误的 JSON 对象的最后一行的行号。 | 
| column\_name | character(127) | 存在错误的字段。 | 
| column\_type | character(10) | 存在错误的字段的数据类型。 | 
| column\_length | character(10) | 列长度（如果适用）。当数据类型具有限制长度时填充此字段。例如，对于数据类型为“character(3)”的列，此列将包含值“3”。 | 
| position | integer | 字段中错误的位置。 | 
| error\_code | integer | 错误代码。 | 
| error\_message | character(512) | 错误的说明。 | 

## 示例查询
<a name="SYS_LOAD_ERROR_DETAIL-sample-queries"></a>

以下查询显示了特定查询的复制命令的加载错误详情。

```
SELECT query_id,
       table_id,
       start_time,
       trim(file_name) AS file_name, 
       trim(column_name) AS column_name, 
       trim(column_type) AS column_type, 
       trim(error_message) AS error_message 
FROM sys_load_error_detail 
WHERE query_id = 762949 
ORDER BY start_time 
LIMIT 10;
```

示例输出。

```
 query_id | table_id |         start_time         |               file_name                  | column_name | column_type |                 error_message
----------+----------+----------------------------+------------------------------------------+-------------+-------------+------------------------------------------------
   762949 |   137885 | 2022-02-15 22:14:46.759151 | s3://load-test/copyfail/wrong_format_000 | id          | int4        | Invalid digit, Value 'a', Pos 0, Type: Integer
   762949 |   137885 | 2022-02-15 22:14:46.759151 | s3://load-test/copyfail/wrong_format_001 | id          | int4        | Invalid digit, Value 'a', Pos 0, Type: Integer
```