

 从补丁 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/)。

# STL\_S3CLIENT\_ERROR
<a name="r_STL_S3CLIENT_ERROR"></a>

记录从 Amazon S3 加载文件时切片遇到的错误。

使用 STL\_S3CLIENT\_ERROR 来查找在从 Amazon S3 传输数据（作为 COPY 命令的一部分）时遇到的错误的详细信息。

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

## 表列
<a name="r_STL_S3CLIENT_ERROR-table-columns2"></a>


| 列名称  | 数据类型  | 描述  | 
| --- | --- | --- | 
| userid | integer | 生成该条目的用户 ID。 | 
| query  | integer | 查询 ID。查询列可用于连接其他系统表和视图。查询 ID -1 供内部使用。 | 
| sliceid | integer | 标识运行查询所在切片的标识符。 | 
| recordtime  | timestamp | 记录的记录时间。 | 
| pid  | integer  | 进程 ID。会话中的所有查询在同一进程中运行，因此，如果您在同一会话中运行一系列查询，则此值保持不变。 | 
| http\_method  | character(64)  | 与 Amazon S3 请求对应的 HTTP 方法名称。 | 
| 桶  | character(64)  | Amazon S3 桶名称。 | 
| key  | character(256)  | 与 Amazon S3 对象对应的键。 | 
| error | character(1024) | 错误消息。 | 
| is\_partial | integer | 值，如果为真 (1)，则表示在 COPY 操作期间将输入文件拆分为范围。如果此值为假 (0)，则不会拆分输入文件。 | 
| start\_offset | bigint | 值，如果在 COPY 操作期间拆分输入文件，则表示拆分的偏移值（以字节为单位）。如果文件未拆分，则此值为 0。 | 

## 使用说明
<a name="w2aac59c29b9c97c11"></a>

如果您看到多个包含“Connection timed out”的错误，您可能遇到了联网问题。如果您使用的是增强型 VPC 路由，请确认您在集群的 VPC 与数据资源之间具有有效的网络路径。有关更多信息，请参阅 [Amazon Redshift 增强型 VPC 路由](https://docs.amazonaws.cn/redshift/latest/mgmt/enhanced-vpc-routing.html)。

## 示例查询
<a name="w2aac59c29b9c97c13"></a>

以下查询返回当前会话期间完成的 COPY 命令中的错误。

```
select query, sliceid, substring(key from 1 for 20) as file, 
substring(error from 1 for 35) as error  
from stl_s3client_error 
where pid = pg_backend_pid()
order by query desc;
```

结果

```
 query  | sliceid |     file           |              error                             
--------+---------+--------------------+------------------------------------
 362228 |      12 | part.tbl.25.159.gz | transfer closed with 1947655 bytes 
 362228 |      24 | part.tbl.15.577.gz | transfer closed with 1881910 bytes 
 362228 |       7 | part.tbl.22.600.gz | transfer closed with 700143 bytes r 
 362228 |      22 | part.tbl.3.34.gz   | transfer closed with 2334528 bytes 
 362228 |      11 | part.tbl.30.274.gz | transfer closed with 699031 bytes r
 362228 |      30 | part.tbl.5.509.gz  | Unknown SSL protocol error in conne
 361999 |      10 | part.tbl.23.305.gz | transfer closed with 698959 bytes r
 361999 |      19 | part.tbl.26.582.gz | transfer closed with 1881458 bytes 
 361999 |       4 | part.tbl.15.629.gz | transfer closed with 2275907 bytes 
 361999 |      20 | part.tbl.6.456.gz  | transfer closed with 692162 bytes r
(10 rows)
```