

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

# Amazon Redshift RSQL 错误代码
<a name="rsql-query-tool-error-codes"></a>

成功消息、警告和异常：


| 错误代码 | 错误类 | 条件名称 | 
| --- | --- | --- | 
| 00000 | 00 类：成功完成 | successful\_completion | 
| 01000 | 01 类：警告 | warning | 
| 0100C | 01 类：警告 | dynamic\_result\_sets\_returned | 
| 01008 | 01 类：警告 | implicit\_zero\_bit\_padding | 
| 01003 | 01 类：警告 | null\_value\_eliminated\_in\_set\_function | 
| 01007 | 01 类：警告 | privilege\_not\_granted | 
| 01006 | 01 类：警告 | privilege\_not\_revoked | 
| 01004 | 01 类：警告 | string\_data\_right\_truncation | 
| 01P01 | 01 类：警告 | deprecated\_feature | 
| 02000 | 02 类：无数据 | no\_data | 
| 02001 | 02 类：无数据 | no\_additional\_dynamic\_result\_sets\_returned | 
| 03000 | 03 类：SQL 语句尚未结束 | sql\_statement\_not\_yet\_complete | 
| 08000 | 08 类：连接异常 | connection\_exception | 
| 08003 | 08 类：连接异常 | connection\_does\_not\_exist | 
| 08006 | 08 类：连接异常 | connection\_failure | 
| 08001 | 08 类：连接异常 | sqlclient\_unable\_to\_establish\_sqlconnection | 
| 08004 | 08 类：连接异常 | sqlserver\_rejected\_establishment\_of\_sqlconnection | 
| 08007 | 08 类：连接异常 | transaction\_resolution\_unknown | 
| 08P01 | 08 类：连接异常 | protocol\_violation | 
| 09000 | 09 类：已触发的操作异常 | triggered\_action\_exception | 
| 0A000 | 0A 类：功能不受支持 | feature\_not\_supported | 
| 0A000 | 0A 类：功能不受支持 | feature\_not\_supported | 
| 0B000 | 0B 类：事务启动无效 | invalid\_transaction\_initiation | 
| 0F000 | 0F 类：定位器异常 | locator\_exception | 
| 0F001 | 0F 类：定位器异常 | invalid\_locator\_specification | 
| 0L000 | 0L 类：授予者无效 | invalid\_grantor | 
| 0LP01 | 0L 类：授予者无效 | invalid\_grant\_operation | 
| 0P000 | 0P 类：角色规范无效 | invalid\_role\_specification | 
| 0Z000 | 0Z 类：诊断异常 | diagnostics\_exception | 
| 0Z002 | 0Z 类：诊断异常 | stacked\_diagnostics\_accessed\_without\_active\_handler | 
| 20000 | 20 类：未找到案例 | case\_not\_found | 
| 21000 | 21 类：基数违规 | cardinality\_violation | 

数据异常：


| 错误代码 | 错误类 | 条件名称 | 
| --- | --- | --- | 
| 22000 | 22 类：数据异常 | data\_exception | 
| 2202E | 22 类：数据异常 | array\_subscript\_error | 
| 22021 | 22 类：数据异常 | character\_not\_in\_repertoire | 
| 22008 | 22 类：数据异常 | datetime\_field\_overflow | 
| 22012 | 22 类：数据异常 | division\_by\_zero | 
| 22005 | 01 类：警告 | error\_in\_assignment | 
| 2200B | 01 类：警告 | escape\_character\_conflict | 
| 22022 | 01 类：警告 | indicator\_overflow | 
| 22015 | 01 类：警告 | interval\_field\_overflow | 
| 2201E | 01 类：警告 | invalid\_argument\_for\_logarithm | 
| 2201F | 01 类：警告 | invalid\_argument\_for\_power\_function | 
| 2201G | 01 类：警告 | invalid\_argument\_for\_width\_bucket\_function | 
| 22018 | 01 类：警告 | invalid\_character\_value\_for\_cast | 
| 22007 | 01 类：警告 | invalid\_datetime\_format | 
| 22019 | 01 类：警告 | invalid\_escape\_character | 
| 2200D | 01 类：警告 | invalid\_escape\_octet | 
| 22025 | 01 类：警告 | invalid\_escape\_sequence | 
| 22P06 | 01 类：警告 | nonstandard\_use\_of\_escape\_character | 
| 22010 | 01 类：警告 | invalid\_indicator\_parameter\_value | 
| 22023 | 01 类：警告 | invalid\_parameter\_value | 
| 2201B | 01 类：警告 | invalid\_regular\_expression | 
| 22009 | 01 类：警告 | invalid\_time\_zone\_displacement\_value | 
| 2200C | 01 类：警告 | invalid\_use\_of\_escape\_character | 
| 2200G | 01 类：警告 | most\_specific\_type\_mismatch | 
| 22004 | 01 类：警告 | null\_value\_not\_allowed | 
| 22002 | 01 类：警告 | null\_value\_no\_indicator\_parameter | 
| 22003 | 01 类：警告 | numeric\_value\_out\_of\_range | 
| 22026 | 01 类：警告 | string\_data\_length\_mismatch | 
| 22001 | 01 类：警告 | string\_data\_right\_truncation | 
| 22011 | 01 类：警告 | substring\_error | 
| 22027 | 01 类：警告 | trim\_error | 
| 22024 | 01 类：警告 | unterminated\_c\_string | 
| 2200F | 01 类：警告 | zero\_length\_character\_string | 
| 22P01 | 01 类：警告 | floating\_point\_exception | 
| 22P02 | 01 类：警告 | invalid\_text\_representation | 
| 22P03 | 01 类：警告 | invalid\_binary\_representation | 
| 22P04 | 01 类：警告 | bad\_copy\_file\_format | 
| 22P05 | 01 类：警告 | untranslatable\_character | 

违反完整性约束：


| 错误代码 | 错误类 | 条件名称 | 
| --- | --- | --- | 
| 23000 | 23 类：违反完整性约束 | integrity\_constraint\_violation | 
| 23001 | 23 类：违反完整性约束 | restrict\_violation | 
| 23502 | 23 类：违反完整性约束 | not\_null\_violation | 
| 23503 | 23 类：违反完整性约束 | foreign\_key\_violation | 
| 23505 | 23 类：违反完整性约束 | unique\_violation | 
| 23514 | 23 类：违反完整性约束 | check\_violation | 
| 24000 | 24 类：游标状态无效 | invalid\_cursor\_state | 
| 01004 | 01 类：警告 | string\_data\_right\_truncation | 
| 25000 | 25 类：事务状态无效 | invalid\_transaction\_state | 
| 25001 | 25 类：事务状态无效 | active\_sql\_transaction | 
| 25002 | 25 类：事务状态无效 | invalid\_transaction\_state | 
| 25008 | 25 类：事务状态无效 | held\_cursor\_requires\_same\_isolation\_level | 
| 25003 | 25 类：事务状态无效 | inappropriate\_access\_mode\_for\_branch\_transaction | 
| 25004 | 25 类：事务状态无效 | inappropriate\_isolation\_level\_for\_branch\_transaction | 
| 25005 | 25 类：事务状态无效 | no\_active\_sql\_transaction\_for\_branch\_transaction | 
| 25006 | 25 类：事务状态无效 | read\_only\_sql\_transaction | 
| 25007 | 25 类：事务状态无效 | no\_active\_sql\_transaction\_for\_branch\_transaction | 
| 25P01 | 25 类：事务状态无效 | no\_active\_sql\_transaction | 
| 25P02 | 25 类：事务状态无效 | in\_failed\_sql\_transaction | 
| 26000 | 26 类：SQL 语句名称无效 | invalid\_sql\_statement\_name | 
| 28000 | 28 类：授权规范无效 | invalid\_authorization\_specification | 
| 2B000 | 2B 类：关联权限描述符依然存在 | dependent\_privilege\_descriptors\_still\_exist | 
| 2BP01 | 2B 类：关联权限描述符依然存在 | dependent\_objects\_still\_exist | 
| 2D000 | 2D 类：事务终止无效 | invalid\_transaction\_termination | 
| 2F000 | 2F 类：SQL 例程异常 | sql\_routine\_exception | 
| 2F005 | 2F 类：SQL 例程异常 | function\_executed\_no\_return\_statement | 
| 2F002 | 2F 类：SQL 例程异常 | modifying\_sql\_data\_not\_permitted | 
| 2F003 | 2F 类：SQL 例程异常 | prohibited\_sql\_statement\_attempted | 
| 2F004 | 2F 类：SQL 例程异常 | reading\_sql\_data\_not\_permitted | 
| 34000 | 34 类：游标名称无效 | invalid\_cursor\_name | 
| 38000 | 38 类：外部例程异常 | external\_routine\_exception | 
| 38001 | 38 类：外部例程异常 | containing\_sql\_not\_permitted | 
| 38002 | 38 类：外部例程异常 | modifying\_sql\_data\_not\_permitted | 
| 38003 | 38 类：外部例程异常 | prohibited\_sql\_statement\_attempted | 
| 38004 | 38 类：外部例程异常 | reading\_sql\_data\_not\_permitted | 
| 39000 | 39 类：外部例程调用异常 | external\_routine\_invocation\_exception | 
| 39001 | 39 类：外部例程调用异常 | invalid\_sqlstate\_returned | 
| 39004 | 39 类：外部例程调用异常 | null\_value\_not\_allowed | 
| 39P01 | 39 类：外部例程调用异常 | trigger\_protocol\_violated | 
| 39P02 | 39 类：外部例程调用异常 | srf\_protocol\_violated | 
| 3D000 | 3D 类：目录名称无效 | invalid\_catalog\_name | 
| 3F000 | 3F 类：架构名称无效 | invalid\_schema\_name | 
| 42000 | 42 类：语法错误或访问规则冲突 | syntax\_error\_or\_access\_rule\_violation | 
| 42601 | 42 类：语法错误或访问规则冲突 | syntax\_error | 
| 42501 | 42 类：语法错误或访问规则冲突 | insufficient\_privilege | 
| 42846 | 42 类：语法错误或访问规则冲突 | cannot\_coerce | 
| 42803 | 42 类：语法错误或访问规则冲突 | grouping\_error | 
| 42830 | 42 类：语法错误或访问规则冲突 | invalid\_foreign\_key | 
| 42602 | 42 类：语法错误或访问规则冲突 | invalid\_name | 
| 42622 | 42 类：语法错误或访问规则冲突 | name\_too\_long | 
| 42939 | 42 类：语法错误或访问规则冲突 | reserved\_name | 
| 42804 | 42 类：语法错误或访问规则冲突 | datatype\_mismatch | 
| 42P18 | 42 类：语法错误或访问规则冲突 | indeterminate\_datatype | 
| 42809 | 42 类：语法错误或访问规则冲突 | wrong\_object\_type | 
| 42703 | 42 类：语法错误或访问规则冲突 | undefined\_column | 
| 42883 | 42 类：语法错误或访问规则冲突 | undefined\_function | 
| 42P01 | 42 类：语法错误或访问规则冲突 | undefined\_table | 
| 42P02 | 42 类：语法错误或访问规则冲突 | undefined\_parameter | 
| 42704 | 42 类：语法错误或访问规则冲突 | undefined\_object | 
| 42701 | 42 类：语法错误或访问规则冲突 | duplicate\_column | 
| 42P03 | 42 类：语法错误或访问规则冲突 | duplicate\_cursor | 
| 42P04 | 42 类：语法错误或访问规则冲突 | duplicate\_database | 
| 42723 | 42 类：语法错误或访问规则冲突 | duplicate\_function | 
| 42P05 | 42 类：语法错误或访问规则冲突 | duplicate\_prepared\_statement | 
| 42P06 | 42 类：语法错误或访问规则冲突 | duplicate\_schema | 
| 42P07 | 42 类：语法错误或访问规则冲突 | duplicate\_table | 
| 42712 | 42 类：语法错误或访问规则冲突 | duplicate\_alias | 
| 42710 | 42 类：语法错误或访问规则冲突 | duplicate\_object | 
| 42702 | 42 类：语法错误或访问规则冲突 | ambiguous\_column | 
| 42725 | 42 类：语法错误或访问规则冲突 | ambiguous\_function | 
| 42P08 | 42 类：语法错误或访问规则冲突 | ambiguous\_parameter | 
| 42P09 | 42 类：语法错误或访问规则冲突 | ambiguous\_alias | 
| 42P10 | 42 类：语法错误或访问规则冲突 | invalid\_column\_reference | 
| 42611 | 42 类：语法错误或访问规则冲突 | invalid\_column\_definition | 
| 42P11 | 42 类：语法错误或访问规则冲突 | invalid\_cursor\_definition | 
| 42P12 | 42 类：语法错误或访问规则冲突 | invalid\_database\_definition | 
| 42P13 | 42 类：语法错误或访问规则冲突 | invalid\_function\_definition | 
| 42P14 | 42 类：语法错误或访问规则冲突 | invalid\_prepared\_statement\_definition | 
| 42P15 | 42 类：语法错误或访问规则冲突 | invalid\_schema\_definition | 
| 42P16 | 42 类：语法错误或访问规则冲突 | invalid\_table\_definition | 
| 42P17 | 42 类：语法错误或访问规则冲突 | invalid\_object\_definition | 
| 44000 | 44 类：WITH CHECK OPTION 违规 | with\_check\_option\_violation | 
| 53000 | 53 类：资源不足 | insufficient\_resources | 
| 53100 | 53 类：资源不足 | disk\_full | 
| 53200 | 53 类：资源不足 | out\_of\_memory | 
| 53300 | 53 类：资源不足 | too\_many\_connections | 
| 54000 | 54 类：已超出程序限制 | program\_limit\_exceeded | 
| 54001 | 54 类：已超出程序限制 | statement\_too\_complex | 
| 54011 | 54 类：已超出程序限制 | too\_many\_columns | 
| 54023 | 54 类：已超出程序限制 | too\_many\_arguments | 
| 55000 | 55 类：对象不在先决条件状态 | object\_not\_in\_prerequisite\_state | 
| 55006 | 55 类：对象不在先决条件状态 | object\_in\_use | 
| 55P02 | 55 类：对象不在先决条件状态 | cant\_change\_runtime\_param | 
| 55P03 | 55 类：对象不在先决条件状态 | lock\_not\_available | 
| 57000 | 57 类：操作员干预 | operator\_intervention | 
| 57014 | 57 类：操作员干预 | query\_canceled | 
| 57P01 | 57 类：操作员干预 | admin\_shutdown | 
| 57P02 | 57 类：操作员干预 | crash\_shutdown | 
| 57P03 | 57 类：操作员干预 | cannot\_connect\_now | 
| 58000 | 58 类：系统错误（PostgreSQL 外部的错误） | system\_error | 
| 58030 | 58 类：系统错误（PostgreSQL 外部的错误） | io\_error | 
| 58P01 | 58 类：系统错误（PostgreSQL 外部的错误） | undefined\_file | 
| 58P02 | 58 类：系统错误（PostgreSQL 外部的错误） | duplicate\_file | 
| F0000 | F0 类：配置文件错误 | duplicate\_file | 
| F0001 | F0 类：配置文件错误 | lock\_file\_exists | 
| P0000 | P0 类：PL/pgSQL 错误 | plpgsql\_error | 
| P0001 | P0 类：PL/pgSQL 错误 | raise\_exception | 
| P0002 | P0 类：PL/pgSQL 错误 | no\_data\_found | 
| P0003 | P0 类：PL/pgSQL 错误 | too\_many\_rows | 
| XX000 | XX 类：内部错误 | internal\_error | 
| XX001 | XX 类：内部错误 | data\_corrupted | 
| XX002 | XX 类：内部错误 | index\_corrupted | 