{"Entry":{"collection":"sqlstate","key":"P0004","name":"P0004","aliases":[],"metadata":{"aliases":[],"case_count":1,"class_code":"P0","condition_name":"assert_failure","condition_names":["assert_failure"],"content_hash":"2ff7cb0bde14a1b25fd95ebb592126f77b7630bc0a911757dc81d7a96f021ad4","depth":"full","editorial_review":"reviewed","evidence_tier":"observed_runtime","imported_at":"2026-09-30T17:45:28.15821+08:00","introduced":null,"known_present_by":"9.5.0","macros":["ERRCODE_ASSERT_FAILURE"],"name_zh":"","present_in":["9.5","9.6","10","11","12","13","14","15","16","17","18","19"],"preview_in":["19"],"primary_macro":"ERRCODE_ASSERT_FAILURE","removed":null,"runtime_verification":"passed","severity_classes":["E"],"snippet_count":1,"source_rev":"english-manuals:7b52e2fa72c2635d8c6f026e04c4234c170292416ad23065c2234b43e0c4d270","sqlstate":"P0004","status":"active","summary_zh":"PL/pgSQL 的 ASSERT 断言条件不成立。"}},"Definition":{"Collection":"sqlstate","Key":"P0004","SourceDatabase":"center","Version":"18","SourceTable":"sqlstate","SourceKey":"P0004","SourceRevision":"english-manuals:7b52e2fa72c2635d8c6f026e04c4234c170292416ad23065c2234b43e0c4d270","Facts":{"aliases":[],"class_name":"PL/pgSQL Error","condition_name":"assert_failure","doc":{"anchor":"ERRCODES-APPENDIX","file":"errcodes-appendix.html","lang":"en","sha256":"56dacf78e618ff0fd8c533e05db597b80d7ebbad7f8e512a888217d0640aa328","slug":"18"},"lang":"en","sqlstate":"P0004"},"ManualEvidence":{"doc":{"anchor":"ERRCODES-APPENDIX","file":"errcodes-appendix.html","lang":"en","sha256":"56dacf78e618ff0fd8c533e05db597b80d7ebbad7f8e512a888217d0640aa328","slug":"18"}},"MeasuredEvidence":{}},"Text":{"Collection":"sqlstate","Key":"P0004","SourceDatabase":"center","Version":"","Locale":"zh-Hans","Title":"P0004 — assert_failure","Summary":"PL/pgSQL 的 ASSERT 断言条件不成立。","BodyHTML":"\u003ch1\u003eP0004\u003c/h1\u003e\n\u003ch2\u003e速览 {#at-a-glance}\u003c/h2\u003e\n\u003cp\u003eP0004 是 PL/pgSQL \u003ccode\u003eassert_failure\u003c/code\u003e。固定 \u003ccode\u003eASSERT\u003c/code\u003e 执行路径确认它以 ERROR 报告，并按是否提供 message 选择错误文本；运行案例已在 PostgreSQL 18.6 和 10.21 上通过。\u003c/p\u003e\n\u003cp\u003e共享的 \u003ccode\u003eassertion_failure_recovery\u003c/code\u003e 案例已在 PostgreSQL 18.6 和 PostgreSQL 10.21 上通过。启用 \u003ccode\u003eplpgsql.check_asserts\u003c/code\u003e 后，失败的 ASSERT 返回 \u003ccode\u003eP0004\u003c/code\u003e 和 \u003ccode\u003evalue must be positive\u003c/code\u003e，显式事务进入 \u003ccode\u003eINERROR\u003c/code\u003e；\u003ccode\u003eROLLBACK\u003c/code\u003e 恢复为 \u003ccode\u003eIDLE\u003c/code\u003e，有效输入执行成功，关闭断言的对照调用返回零。\u003c/p\u003e\n\u003cpre\u003e\u003ccode\u003eCREATE OR REPLACE FUNCTION p0004_assert(value integer) RETURNS integer LANGUAGE plpgsql AS $$ BEGIN ASSERT value \u0026gt; 0, \u0026#39;value must be positive\u0026#39;; RETURN value; END $$;\nSET plpgsql.check_asserts = on;\nSHOW plpgsql.check_asserts;\nBEGIN;\nSELECT p0004_assert(0);\nROLLBACK;\nSELECT p0004_assert(1);\nSET plpgsql.check_asserts = off;\nSHOW plpgsql.check_asserts;\nSELECT p0004_assert(0);\nSET plpgsql.check_asserts = on;\nSHOW plpgsql.check_asserts;\nSELECT p0004_assert(1);\n\u003c/code\u003e\u003c/pre\u003e\n\u003ch2\u003e含义 {#meaning}\u003c/h2\u003e\n\u003cp\u003eASSERT 是 PL/pgSQL 中执行的不变量检查。PostgreSQL 计算其 Boolean 条件；结果为 \u003cstrong\u003efalse 或 NULL\u003c/strong\u003e 时进入断言失败路径。固定执行器随后以 ERROR 和 SQLSTATE \u003ccode\u003eP0004\u003c/code\u003e 报告：只在进入该路径后计算 message 表达式，非 NULL 结果成为主报文，NULL 或省略 message 时使用 \u003ccode\u003eassertion failed\u003c/code\u003e。关闭检查时，条件和 message 表达式都会跳过。\u003c/p\u003e\n\u003cp\u003e\u003ccode\u003eplpgsql.check_asserts\u003c/code\u003e 是按会话生效的设置，用来控制是否检查 ASSERT。启用时，失败断言是真正的 ERROR，显式事务会进入 \u003ccode\u003eINERROR\u003c/code\u003e；关闭时 ASSERT 会被跳过，同一个 false 输入不能证明不变量成立，也不能替代生产环境的输入校验。\u003c/p\u003e\n\u003cp\u003e选定运行覆盖了带非 NULL message 的 false 条件，以及关闭检查时的 false 条件。\u003ccode\u003eNULL\u003c/code\u003e 条件和无 message 的回退文本是源码确认的语义，不是本批额外的自然运行观察。\u003c/p\u003e\n\u003ch2\u003e诊断 {#diagnosis}\u003c/h2\u003e\n\u003cp\u003e先把 ErrorResponse 字段与服务器日志中的同一条记录对照。固定 18.6 路径的 \u003ccode\u003emessage_primary\u003c/code\u003e 是计算后的 message 或 \u003ccode\u003eassertion failed\u003c/code\u003e；运行案例还记录了 \u003ccode\u003eERROR\u003c/code\u003e、\u003ccode\u003eP0004\u003c/code\u003e、\u003ccode\u003eexec_stmt_assert\u003c/code\u003e，以及指向 PL/pgSQL 函数和 \u003ccode\u003eline 1 at ASSERT\u003c/code\u003e 的 context。要在出错的同一个会话执行 \u003ccode\u003eSHOW plpgsql.check_asserts\u003c/code\u003e，其他连接的设置不会影响它。\u003c/p\u003e\n\u003cp\u003e如果主报文是 \u003ccode\u003eassertion failed\u003c/code\u003e，检查 ASSERT 是否没有 message，或 message 表达式是否计算为 NULL。如果完全没有 P0004，先检查 \u003ccode\u003eSHOW plpgsql.check_asserts\u003c/code\u003e：关闭时会在计算条件前跳过检查。比较调用时要同时保留函数源码和会话设置；连接池中的另一个连接可能有不同设置，即使它们调用的是同一个函数。\u003c/p\u003e\n\u003cp\u003e区分程序不变量和预期业务输入。\u003ccode\u003evalue \u0026gt; 0\u003c/code\u003e 这类 ASSERT 适合检查经过验证后本应永远成立的假设；预期的负数等业务输入应使用普通校验、约束或明确的应用错误。若错误发生在显式事务中，先检查事务状态再发送下一条命令：运行案例中事务在 \u003ccode\u003eROLLBACK\u003c/code\u003e 前是 \u003ccode\u003eINERROR\u003c/code\u003e，并不是连接已经失效。\u003c/p\u003e\n\u003ch2\u003e处置 {#response}\u003c/h2\u003e\n\u003cp\u003e显式事务中先执行 \u003ccode\u003eROLLBACK\u003c/code\u003e，再以修正后的不变量或输入重现。共享案例验证了 \u003ccode\u003eROLLBACK → IDLE\u003c/code\u003e、有效调用返回 \u003ccode\u003e1\u003c/code\u003e，以及把 \u003ccode\u003eplpgsql.check_asserts\u003c/code\u003e 设为 \u003ccode\u003eoff\u003c/code\u003e 后同一个 false 输入不再报告断言。\u003c/p\u003e\n\u003cp\u003e如果 PL/pgSQL block 有意处理这个命名条件，可以使用 \u003ccode\u003eWHEN ASSERT_FAILURE\u003c/code\u003e。\u003ccode\u003eWHEN OTHERS\u003c/code\u003e 不会捕获 \u003ccode\u003eASSERT_FAILURE\u003c/code\u003e，因此不能靠宽泛 handler 隐藏断言失败。异常块可以按文档规定的子事务边界恢复，但吞掉错误前必须检查不变量；关闭断言只是诊断对照，不是修复。\u003c/p\u003e\n\u003ch2\u003e版本 {#versions}\u003c/h2\u003e\n\u003cp\u003e锁定目录从 9.5.0 记录 P0004，并在列出的正式快照及 19beta3 中出现。固定执行器源码是 PostgreSQL 18.6 的 \u003ca href=\"https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/pl/plpgsql/src/pl_exec.c#L3965-L3968\" rel=\"nofollow\"\u003e\u003ccode\u003epl_exec.c#L3965-L3968\u003c/code\u003e\u003c/a\u003e。官方 \u003ca href=\"/docs/18/plpgsql-errors-and-messages.html\" rel=\"nofollow\"\u003ePL/pgSQL 错误和消息文档\u003c/a\u003e说明 ASSERT 和命名条件；\u003ca href=\"/docs/18/plpgsql-control-structures.html#PLPGSQL-ERROR-TRAPPING\" rel=\"nofollow\"\u003e控制结构中的错误捕获文档\u003c/a\u003e定义 \u003ccode\u003eEXCEPTION\u003c/code\u003e 子事务及 handler 匹配边界。最新版本与 PG10 的运行案例确认了共享函数中的 P0004 和事务行为。\u003c/p\u003e\n\u003ch2\u003e相关条件 {#related}\u003c/h2\u003e\n\u003cp\u003e\u003ca href=\"/wiki/sqlstate/P0002/\" rel=\"nofollow\"\u003e\u003ccode\u003eP0002\u003c/code\u003e\u003c/a\u003e 是 PL/pgSQL 无数据条件， \u003ca href=\"/wiki/sqlstate/P0003/\" rel=\"nofollow\"\u003e\u003ccode\u003eP0003\u003c/code\u003e\u003c/a\u003e 是严格多行条件， \u003ca href=\"/wiki/sqlstate/P0000/\" rel=\"nofollow\"\u003e\u003ccode\u003eP0000\u003c/code\u003e\u003c/a\u003e 是 PL/pgSQL 错误类别。应以响应中的实际 SQLSTATE 为准，不要把所有 PL/pgSQL 失败都归为 P0004。\u003c/p\u003e\n\u003ch2\u003e来源 {#sources}\u003c/h2\u003e\n\u003cp\u003e固定实现见 \u003ca href=\"https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/pl/plpgsql/src/pl_exec.c#L3965-L3968\" rel=\"nofollow\"\u003e\u003ccode\u003epl_exec.c#L3965-L3968\u003c/code\u003e\u003c/a\u003e。官方 \u003ca href=\"/docs/18/plpgsql-errors-and-messages.html\" rel=\"nofollow\"\u003ePL/pgSQL 错误和消息参考\u003c/a\u003e说明 ASSERT 语义；\u003ca href=\"/docs/18/plpgsql-control-structures.html#PLPGSQL-ERROR-TRAPPING\" rel=\"nofollow\"\u003e控制结构中的错误捕获参考\u003c/a\u003e说明 \u003ccode\u003eWHEN OTHERS\u003c/code\u003e 排除项和子事务边界。结构化的\u003ca href=\"#sources\" rel=\"nofollow\"\u003e证据记录\u003c/a\u003e固定了源码 SHA、运行摘要、原始结果和共享片段注册表。\u003c/p\u003e\n","SourceRevision":"english-manuals:7b52e2fa72c2635d8c6f026e04c4234c170292416ad23065c2234b43e0c4d270","ContentHash":"50a4b558d5b6140a0243045f1233500febc66bc039f1a57dd9c52481ca83f6f6","Payload":{"body_md":"# P0004\n\n## 速览 {#at-a-glance}\n\nP0004 是 PL/pgSQL `assert_failure`。固定 `ASSERT` 执行路径确认它以 ERROR 报告，并按是否提供 message 选择错误文本；运行案例已在 PostgreSQL 18.6 和 10.21 上通过。\n\n\n共享的 `assertion_failure_recovery` 案例已在 PostgreSQL 18.6 和 PostgreSQL 10.21 上通过。启用 `plpgsql.check_asserts` 后，失败的 ASSERT 返回 `P0004` 和 `value must be positive`，显式事务进入 `INERROR`；`ROLLBACK` 恢复为 `IDLE`，有效输入执行成功，关闭断言的对照调用返回零。\n\n```sql\nCREATE OR REPLACE FUNCTION p0004_assert(value integer) RETURNS integer LANGUAGE plpgsql AS $$ BEGIN ASSERT value \u003e 0, 'value must be positive'; RETURN value; END $$;\nSET plpgsql.check_asserts = on;\nSHOW plpgsql.check_asserts;\nBEGIN;\nSELECT p0004_assert(0);\nROLLBACK;\nSELECT p0004_assert(1);\nSET plpgsql.check_asserts = off;\nSHOW plpgsql.check_asserts;\nSELECT p0004_assert(0);\nSET plpgsql.check_asserts = on;\nSHOW plpgsql.check_asserts;\nSELECT p0004_assert(1);\n```\n\n## 含义 {#meaning}\n\nASSERT 是 PL/pgSQL 中执行的不变量检查。PostgreSQL 计算其 Boolean 条件；结果为 **false 或 NULL** 时进入断言失败路径。固定执行器随后以 ERROR 和 SQLSTATE `P0004` 报告：只在进入该路径后计算 message 表达式，非 NULL 结果成为主报文，NULL 或省略 message 时使用 `assertion failed`。关闭检查时，条件和 message 表达式都会跳过。\n\n`plpgsql.check_asserts` 是按会话生效的设置，用来控制是否检查 ASSERT。启用时，失败断言是真正的 ERROR，显式事务会进入 `INERROR`；关闭时 ASSERT 会被跳过，同一个 false 输入不能证明不变量成立，也不能替代生产环境的输入校验。\n\n选定运行覆盖了带非 NULL message 的 false 条件，以及关闭检查时的 false 条件。`NULL` 条件和无 message 的回退文本是源码确认的语义，不是本批额外的自然运行观察。\n\n## 诊断 {#diagnosis}\n\n先把 ErrorResponse 字段与服务器日志中的同一条记录对照。固定 18.6 路径的 `message_primary` 是计算后的 message 或 `assertion failed`；运行案例还记录了 `ERROR`、`P0004`、`exec_stmt_assert`，以及指向 PL/pgSQL 函数和 `line 1 at ASSERT` 的 context。要在出错的同一个会话执行 `SHOW plpgsql.check_asserts`，其他连接的设置不会影响它。\n\n如果主报文是 `assertion failed`，检查 ASSERT 是否没有 message，或 message 表达式是否计算为 NULL。如果完全没有 P0004，先检查 `SHOW plpgsql.check_asserts`：关闭时会在计算条件前跳过检查。比较调用时要同时保留函数源码和会话设置；连接池中的另一个连接可能有不同设置，即使它们调用的是同一个函数。\n\n区分程序不变量和预期业务输入。`value \u003e 0` 这类 ASSERT 适合检查经过验证后本应永远成立的假设；预期的负数等业务输入应使用普通校验、约束或明确的应用错误。若错误发生在显式事务中，先检查事务状态再发送下一条命令：运行案例中事务在 `ROLLBACK` 前是 `INERROR`，并不是连接已经失效。\n\n## 处置 {#response}\n\n显式事务中先执行 `ROLLBACK`，再以修正后的不变量或输入重现。共享案例验证了 `ROLLBACK → IDLE`、有效调用返回 `1`，以及把 `plpgsql.check_asserts` 设为 `off` 后同一个 false 输入不再报告断言。\n\n如果 PL/pgSQL block 有意处理这个命名条件，可以使用 `WHEN ASSERT_FAILURE`。`WHEN OTHERS` 不会捕获 `ASSERT_FAILURE`，因此不能靠宽泛 handler 隐藏断言失败。异常块可以按文档规定的子事务边界恢复，但吞掉错误前必须检查不变量；关闭断言只是诊断对照，不是修复。\n\n## 版本 {#versions}\n\n锁定目录从 9.5.0 记录 P0004，并在列出的正式快照及 19beta3 中出现。固定执行器源码是 PostgreSQL 18.6 的 [`pl_exec.c#L3965-L3968`](https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/pl/plpgsql/src/pl_exec.c#L3965-L3968)。官方 [PL/pgSQL 错误和消息文档](/docs/18/plpgsql-errors-and-messages.html)说明 ASSERT 和命名条件；[控制结构中的错误捕获文档](/docs/18/plpgsql-control-structures.html#PLPGSQL-ERROR-TRAPPING)定义 `EXCEPTION` 子事务及 handler 匹配边界。最新版本与 PG10 的运行案例确认了共享函数中的 P0004 和事务行为。\n\n## 相关条件 {#related}\n\n[`P0002`](/wiki/sqlstate/P0002/) 是 PL/pgSQL 无数据条件， [`P0003`](/wiki/sqlstate/P0003/) 是严格多行条件， [`P0000`](/wiki/sqlstate/P0000/) 是 PL/pgSQL 错误类别。应以响应中的实际 SQLSTATE 为准，不要把所有 PL/pgSQL 失败都归为 P0004。\n\n## 来源 {#sources}\n\n固定实现见 [`pl_exec.c#L3965-L3968`](https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/pl/plpgsql/src/pl_exec.c#L3965-L3968)。官方 [PL/pgSQL 错误和消息参考](/docs/18/plpgsql-errors-and-messages.html)说明 ASSERT 语义；[控制结构中的错误捕获参考](/docs/18/plpgsql-control-structures.html#PLPGSQL-ERROR-TRAPPING)说明 `WHEN OTHERS` 排除项和子事务边界。结构化的[证据记录](#sources)固定了源码 SHA、运行摘要、原始结果和共享片段注册表。\n","description":"PostgreSQL SQLSTATE P0004 的源码与诊断参考。","is_stale":false,"name":"","sections":[{"anchor":"","heading":"","html":"\u0026lt;h1\u0026gt;P0004\u0026lt;/h1\u0026gt;"},{"anchor":"at-a-glance","heading":"速览","html":"\u003cp\u003eP0004 是 PL/pgSQL \u003ccode\u003eassert_failure\u003c/code\u003e。固定 \u003ccode\u003eASSERT\u003c/code\u003e 执行路径确认它以 ERROR 报告，并按是否提供 message 选择错误文本；运行案例已在 PostgreSQL 18.6 和 10.21 上通过。\u003c/p\u003e\n\u003cp\u003e共享的 \u003ccode\u003eassertion_failure_recovery\u003c/code\u003e 案例已在 PostgreSQL 18.6 和 PostgreSQL 10.21 上通过。启用 \u003ccode\u003eplpgsql.check_asserts\u003c/code\u003e 后，失败的 ASSERT 返回 \u003ccode\u003eP0004\u003c/code\u003e 和 \u003ccode\u003evalue must be positive\u003c/code\u003e，显式事务进入 \u003ccode\u003eINERROR\u003c/code\u003e；\u003ccode\u003eROLLBACK\u003c/code\u003e 恢复为 \u003ccode\u003eIDLE\u003c/code\u003e，有效输入执行成功，关闭断言的对照调用返回零。\u003c/p\u003e\n\u003cpre\u003e\u003ccode class=\"language-sql\"\u003eCREATE OR REPLACE FUNCTION p0004_assert(value integer) RETURNS integer LANGUAGE plpgsql AS $$ BEGIN ASSERT value \u0026gt; 0, 'value must be positive'; RETURN value; END $$;\nSET plpgsql.check_asserts = on;\nSHOW plpgsql.check_asserts;\nBEGIN;\nSELECT p0004_assert(0);\nROLLBACK;\nSELECT p0004_assert(1);\nSET plpgsql.check_asserts = off;\nSHOW plpgsql.check_asserts;\nSELECT p0004_assert(0);\nSET plpgsql.check_asserts = on;\nSHOW plpgsql.check_asserts;\nSELECT p0004_assert(1);\n\u003c/code\u003e\u003c/pre\u003e"},{"anchor":"meaning","heading":"含义","html":"\u003cp\u003eASSERT 是 PL/pgSQL 中执行的不变量检查。PostgreSQL 计算其 Boolean 条件；结果为 \u003cstrong\u003efalse 或 NULL\u003c/strong\u003e 时进入断言失败路径。固定执行器随后以 ERROR 和 SQLSTATE \u003ccode\u003eP0004\u003c/code\u003e 报告：只在进入该路径后计算 message 表达式，非 NULL 结果成为主报文，NULL 或省略 message 时使用 \u003ccode\u003eassertion failed\u003c/code\u003e。关闭检查时，条件和 message 表达式都会跳过。\u003c/p\u003e\n\u003cp\u003e\u003ccode\u003eplpgsql.check_asserts\u003c/code\u003e 是按会话生效的设置，用来控制是否检查 ASSERT。启用时，失败断言是真正的 ERROR，显式事务会进入 \u003ccode\u003eINERROR\u003c/code\u003e；关闭时 ASSERT 会被跳过，同一个 false 输入不能证明不变量成立，也不能替代生产环境的输入校验。\u003c/p\u003e\n\u003cp\u003e选定运行覆盖了带非 NULL message 的 false 条件，以及关闭检查时的 false 条件。\u003ccode\u003eNULL\u003c/code\u003e 条件和无 message 的回退文本是源码确认的语义，不是本批额外的自然运行观察。\u003c/p\u003e"},{"anchor":"diagnosis","heading":"诊断","html":"\u003cp\u003e先把 ErrorResponse 字段与服务器日志中的同一条记录对照。固定 18.6 路径的 \u003ccode\u003emessage_primary\u003c/code\u003e 是计算后的 message 或 \u003ccode\u003eassertion failed\u003c/code\u003e；运行案例还记录了 \u003ccode\u003eERROR\u003c/code\u003e、\u003ccode\u003eP0004\u003c/code\u003e、\u003ccode\u003eexec_stmt_assert\u003c/code\u003e，以及指向 PL/pgSQL 函数和 \u003ccode\u003eline 1 at ASSERT\u003c/code\u003e 的 context。要在出错的同一个会话执行 \u003ccode\u003eSHOW plpgsql.check_asserts\u003c/code\u003e，其他连接的设置不会影响它。\u003c/p\u003e\n\u003cp\u003e如果主报文是 \u003ccode\u003eassertion failed\u003c/code\u003e，检查 ASSERT 是否没有 message，或 message 表达式是否计算为 NULL。如果完全没有 P0004，先检查 \u003ccode\u003eSHOW plpgsql.check_asserts\u003c/code\u003e：关闭时会在计算条件前跳过检查。比较调用时要同时保留函数源码和会话设置；连接池中的另一个连接可能有不同设置，即使它们调用的是同一个函数。\u003c/p\u003e\n\u003cp\u003e区分程序不变量和预期业务输入。\u003ccode\u003evalue \u0026gt; 0\u003c/code\u003e 这类 ASSERT 适合检查经过验证后本应永远成立的假设；预期的负数等业务输入应使用普通校验、约束或明确的应用错误。若错误发生在显式事务中，先检查事务状态再发送下一条命令：运行案例中事务在 \u003ccode\u003eROLLBACK\u003c/code\u003e 前是 \u003ccode\u003eINERROR\u003c/code\u003e，并不是连接已经失效。\u003c/p\u003e"},{"anchor":"response","heading":"处置","html":"\u003cp\u003e显式事务中先执行 \u003ccode\u003eROLLBACK\u003c/code\u003e，再以修正后的不变量或输入重现。共享案例验证了 \u003ccode\u003eROLLBACK → IDLE\u003c/code\u003e、有效调用返回 \u003ccode\u003e1\u003c/code\u003e，以及把 \u003ccode\u003eplpgsql.check_asserts\u003c/code\u003e 设为 \u003ccode\u003eoff\u003c/code\u003e 后同一个 false 输入不再报告断言。\u003c/p\u003e\n\u003cp\u003e如果 PL/pgSQL block 有意处理这个命名条件，可以使用 \u003ccode\u003eWHEN ASSERT_FAILURE\u003c/code\u003e。\u003ccode\u003eWHEN OTHERS\u003c/code\u003e 不会捕获 \u003ccode\u003eASSERT_FAILURE\u003c/code\u003e，因此不能靠宽泛 handler 隐藏断言失败。异常块可以按文档规定的子事务边界恢复，但吞掉错误前必须检查不变量；关闭断言只是诊断对照，不是修复。\u003c/p\u003e"},{"anchor":"versions","heading":"版本","html":"\u003cp\u003e锁定目录从 9.5.0 记录 P0004，并在列出的正式快照及 19beta3 中出现。固定执行器源码是 PostgreSQL 18.6 的 \u003ca href=\"https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/pl/plpgsql/src/pl_exec.c#L3965-L3968\"\u003e\u003ccode\u003epl_exec.c#L3965-L3968\u003c/code\u003e\u003c/a\u003e。官方 \u003ca href=\"/docs/18/plpgsql-errors-and-messages.html\"\u003ePL/pgSQL 错误和消息文档\u003c/a\u003e说明 ASSERT 和命名条件；\u003ca href=\"/docs/18/plpgsql-control-structures.html#PLPGSQL-ERROR-TRAPPING\"\u003e控制结构中的错误捕获文档\u003c/a\u003e定义 \u003ccode\u003eEXCEPTION\u003c/code\u003e 子事务及 handler 匹配边界。最新版本与 PG10 的运行案例确认了共享函数中的 P0004 和事务行为。\u003c/p\u003e"},{"anchor":"related","heading":"相关条件","html":"\u003cp\u003e\u003ca href=\"/wiki/sqlstate/P0002/\"\u003e\u003ccode\u003eP0002\u003c/code\u003e\u003c/a\u003e 是 PL/pgSQL 无数据条件， \u003ca href=\"/wiki/sqlstate/P0003/\"\u003e\u003ccode\u003eP0003\u003c/code\u003e\u003c/a\u003e 是严格多行条件， \u003ca href=\"/wiki/sqlstate/P0000/\"\u003e\u003ccode\u003eP0000\u003c/code\u003e\u003c/a\u003e 是 PL/pgSQL 错误类别。应以响应中的实际 SQLSTATE 为准，不要把所有 PL/pgSQL 失败都归为 P0004。\u003c/p\u003e"},{"anchor":"sources","heading":"来源","html":"\u003cp\u003e固定实现见 \u003ca href=\"https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/pl/plpgsql/src/pl_exec.c#L3965-L3968\"\u003e\u003ccode\u003epl_exec.c#L3965-L3968\u003c/code\u003e\u003c/a\u003e。官方 \u003ca href=\"/docs/18/plpgsql-errors-and-messages.html\"\u003ePL/pgSQL 错误和消息参考\u003c/a\u003e说明 ASSERT 语义；\u003ca href=\"/docs/18/plpgsql-control-structures.html#PLPGSQL-ERROR-TRAPPING\"\u003e控制结构中的错误捕获参考\u003c/a\u003e说明 \u003ccode\u003eWHEN OTHERS\u003c/code\u003e 排除项和子事务边界。结构化的\u003ca href=\"#sources\"\u003e证据记录\u003c/a\u003e固定了源码 SHA、运行摘要、原始结果和共享片段注册表。\u003c/p\u003e"}],"summary":"PL/pgSQL 的 ASSERT 断言条件不成立。","title":"P0004 — assert_failure","translation_source_rev":"df71634a4c96ebff6850ccab7369594b9bea62e34afd45af1b343406748622e8"}},"RequestedLocale":"zh-Hans","Fallback":false,"Versions":["10","11","12","13","14","15","16","17","18","19","20","9.5","9.6"],"Locales":["en","zh-Hans"],"Signatures":null,"Spellings":null,"SQLState":{"aliases":[],"catalogue_notes":{"earliest_observed":"9.5.0","formal_scope":"9.0.0..18.6","latest_observed":"18.6","matrix_scope":["9.0.23","9.1.24","9.2.24","9.3.25","9.4.26","9.5.25","9.6.24","10.23","11.22","12.22","13.23","14.24","15.19","16.15","17.11","18.6"],"pre9_scope":{"formal_tag_count":191,"maximum_release":"8.4.22","minimum_release":"7.0.0","source_definition_count":153,"source_doc_count":153,"source_file_count":306,"source_scope":"7.4..8.4 definition files; 7.0..7.3 candidate-path source gap probes","source_tag_count":153},"pre9_status":"not_observed","preview_scope":["19beta3"]},"class":"P0","class_name":"PL/pgSQL Error","condition_name":"assert_failure","condition_names":["assert_failure"],"definition_changes":[],"english_manuals":{"10":{"aliases":[],"class_name":"PL/pgSQL Error","condition_name":"assert_failure","doc":{"anchor":"ERRCODES-APPENDIX","file":"errcodes-appendix.html","lang":"en","sha256":"9607b57e9f639b61785677ba4d226f5889fe1d19c8bf55a3337691899a9073cd","slug":"10"},"lang":"en","sqlstate":"P0004"},"11":{"aliases":[],"class_name":"PL/pgSQL Error","condition_name":"assert_failure","doc":{"anchor":"ERRCODES-APPENDIX","file":"errcodes-appendix.html","lang":"en","sha256":"3a024e38263ad77de228eed7930b842b42dc1d5cab9ca3727be8eed872ec9539","slug":"11"},"lang":"en","sqlstate":"P0004"},"12":{"aliases":[],"class_name":"PL/pgSQL Error","condition_name":"assert_failure","doc":{"anchor":"ERRCODES-APPENDIX","file":"errcodes-appendix.html","lang":"en","sha256":"1444bd6a138537cd75be88a220ee9472ac528f0cfc58758e49636d85455efe98","slug":"12"},"lang":"en","sqlstate":"P0004"},"13":{"aliases":[],"class_name":"PL/pgSQL Error","condition_name":"assert_failure","doc":{"anchor":"ERRCODES-APPENDIX","file":"errcodes-appendix.html","lang":"en","sha256":"4a3ef8af218e5736dfde8660ba609e84233b6b3bac7e0210ff8724cf1b27b2db","slug":"13"},"lang":"en","sqlstate":"P0004"},"14":{"aliases":[],"class_name":"PL/pgSQL Error","condition_name":"assert_failure","doc":{"anchor":"ERRCODES-APPENDIX","file":"errcodes-appendix.html","lang":"en","sha256":"1c12e83304e0f4ff64c9d98ca5e3007df6756932ed19867a4fa0e0650f6c5751","slug":"14"},"lang":"en","sqlstate":"P0004"},"15":{"aliases":[],"class_name":"PL/pgSQL Error","condition_name":"assert_failure","doc":{"anchor":"ERRCODES-APPENDIX","file":"errcodes-appendix.html","lang":"en","sha256":"2161f58f6e87f6535b3b1f3d4661427bb6765f4f6b074fcc16fac97594b50599","slug":"15"},"lang":"en","sqlstate":"P0004"},"16":{"aliases":[],"class_name":"PL/pgSQL Error","condition_name":"assert_failure","doc":{"anchor":"ERRCODES-APPENDIX","file":"errcodes-appendix.html","lang":"en","sha256":"928e705933d7c3d018ae3fba9d800b34e6325746d157339dce878473c519d100","slug":"16"},"lang":"en","sqlstate":"P0004"},"17":{"aliases":[],"class_name":"PL/pgSQL Error","condition_name":"assert_failure","doc":{"anchor":"ERRCODES-APPENDIX","file":"errcodes-appendix.html","lang":"en","sha256":"868135520af87351e3ea1ba42656111cbd2d157d98e1fef05ea158ac5729d8b1","slug":"17"},"lang":"en","sqlstate":"P0004"},"18":{"aliases":[],"class_name":"PL/pgSQL Error","condition_name":"assert_failure","doc":{"anchor":"ERRCODES-APPENDIX","file":"errcodes-appendix.html","lang":"en","sha256":"56dacf78e618ff0fd8c533e05db597b80d7ebbad7f8e512a888217d0640aa328","slug":"18"},"lang":"en","sqlstate":"P0004"},"19":{"aliases":[],"class_name":"PL/pgSQL Error","condition_name":"assert_failure","doc":{"anchor":"ERRCODES-APPENDIX","file":"errcodes-appendix.html","lang":"en","sha256":"63fb8d1aa9f494eeab9d0f8542a2b673f7746ee41ae2689d19403cb3cc425a5c","slug":"19"},"lang":"en","sqlstate":"P0004"},"20":{"aliases":[],"class_name":"PL/pgSQL Error","condition_name":"assert_failure","doc":{"anchor":"ERRCODES-APPENDIX","file":"errcodes-appendix.html","lang":"en","sha256":"0d3f602127cd137cf343b32d5fa78f175eeb6cdcb6353b1f6f998ede6cb7b911","slug":"devel"},"lang":"en","sqlstate":"P0004"},"9.5":{"aliases":[],"class_name":"PL/pgSQL Error","condition_name":"assert_failure","doc":{"anchor":"ERRCODES-APPENDIX","file":"errcodes-appendix.html","lang":"en","sha256":"d40bc67cb331f1e4ccc0821ff57832c6c230edb0dce3ba4249defd21ae7ea29d","slug":"9.5"},"lang":"en","sqlstate":"P0004"},"9.6":{"aliases":[],"class_name":"PL/pgSQL Error","condition_name":"assert_failure","doc":{"anchor":"ERRCODES-APPENDIX","file":"errcodes-appendix.html","lang":"en","sha256":"2ab55e487571c8998ec39b3d1bbae29ac6fc5c310875bee422d9a7b8b3fde5b3","slug":"9.6"},"lang":"en","sqlstate":"P0004"}},"history_boundary":{"earliest_observed":"9.5.0","formal_tag_count":351,"gaps":[{"after":"18.6","before":"18.4","reason":"Non-adjacent release tags or a source gap; no removal is inferred."}],"latest_observed":"18.6","pre_range":{"first_observed":null,"known_lower_bound":null,"last_observed":null,"notes":"No occurrence was observed in the locked 7.4..8.4 definition files. Source gaps for 7.0..7.3 prevent a claim that the code was absent before 7.4.","scanned_formal_release_count":153,"scanned_source_scope":"7.4..8.4 definition files; 7.0..7.3 candidate-path source gap probes","source_gap_majors":["7.0","7.1","7.2","7.3"],"status":"partially_scanned"},"preview_snapshots":["19beta3"],"scanned_from":"9.0.0","scanned_to":"18.6"},"introduced":null,"known_present_by":"9.5.0","macros":["ERRCODE_ASSERT_FAILURE"],"manual_presence":["9.5","9.6","10","11","12","13","14","15","16","17","18","19","20"],"pre9_first_observed":null,"pre9_introduction_boundary":null,"pre9_last_observed":null,"pre9_presence_intervals":[],"pre9_status":"not_observed","presence_intervals":[{"end":"9.5.25","end_major":"9.5","end_tag":"REL9_5_25","evidence_count":26,"position":0,"start":"9.5.0","start_major":"9.5","start_tag":"REL9_5_0"},{"end":"9.6.24","end_major":"9.6","end_tag":"REL9_6_24","evidence_count":25,"position":1,"start":"9.6.0","start_major":"9.6","start_tag":"REL9_6_0"},{"end":"10.23","end_major":"10","end_tag":"REL_10_23","evidence_count":24,"position":2,"start":"10.0","start_major":"10","start_tag":"REL_10_0"},{"end":"11.22","end_major":"11","end_tag":"REL_11_22","evidence_count":23,"position":3,"start":"11.0","start_major":"11","start_tag":"REL_11_0"},{"end":"12.22","end_major":"12","end_tag":"REL_12_22","evidence_count":23,"position":4,"start":"12.0","start_major":"12","start_tag":"REL_12_0"},{"end":"13.23","end_major":"13","end_tag":"REL_13_23","evidence_count":24,"position":5,"start":"13.0","start_major":"13","start_tag":"REL_13_0"},{"end":"14.24","end_major":"14","end_tag":"REL_14_24","evidence_count":25,"position":6,"start":"14.0","start_major":"14","start_tag":"REL_14_0"},{"end":"15.19","end_major":"15","end_tag":"REL_15_19","evidence_count":20,"position":7,"start":"15.0","start_major":"15","start_tag":"REL_15_0"},{"end":"16.15","end_major":"16","end_tag":"REL_16_15","evidence_count":16,"position":8,"start":"16.0","start_major":"16","start_tag":"REL_16_0"},{"end":"17.11","end_major":"17","end_tag":"REL_17_11","evidence_count":12,"position":9,"start":"17.0","start_major":"17","start_tag":"REL_17_0"},{"end":"18.4","end_major":"18","end_tag":"REL_18_4","evidence_count":5,"position":10,"start":"18.0","start_major":"18","start_tag":"REL_18_0"},{"end":"18.6","end_major":"18","end_tag":"REL_18_6","evidence_count":1,"position":11,"start":"18.6","start_major":"18","start_tag":"REL_18_6"}],"present_in_snapshots":["9.5.25","9.6.24","10.23","11.22","12.22","13.23","14.24","15.19","16.15","17.11","18.6","19beta3"],"preview_in_snapshots":["19beta3"],"primary_macro":"ERRCODE_ASSERT_FAILURE","removed":null,"schema_version":2,"severity_classes":["E"],"sources":[{"blob_id":"sha256:37f728a7e034ef0b05b060a4b82c7dd95c900e4a5501c80bfefd8d679889253b","channel":"formal","code_count":236,"commit":"cdd4ed5449bf317cc71b45a8deee0173822e7592","id":"postgresql:REL9_5_0:src/backend/utils/errcodes.txt","major":"9.5","parsed_path":"raw/definitions/REL9_5_0.parsed.json","path":"src/backend/utils/errcodes.txt","raw_path":"raw/definitions/REL9_5_0.txt","raw_url":"https://raw.githubusercontent.com/postgres/postgres/cdd4ed5449bf317cc71b45a8deee0173822e7592/src/backend/utils/errcodes.txt","record_count":242,"release":"9.5.0","release_date":null,"repository":"https://github.com/postgres/postgres.git","sha256":"37f728a7e034ef0b05b060a4b82c7dd95c900e4a5501c80bfefd8d679889253b","size":30798,"source_format":"errcodes.txt","source_role":"primary_definition","tag":"REL9_5_0","url":"https://github.com/postgres/postgres/blob/cdd4ed5449bf317cc71b45a8deee0173822e7592/src/backend/utils/errcodes.txt","version":"9.5.0"},{"blob_id":"sha256:bf4d94d84c7cfe695cb80e8f009872444574719a80a72e347eb66ef3686b86ef","channel":"formal","code_count":238,"commit":"a721a1ba9cf6c86cb52f1bf325d5a27b64e870d6","id":"postgresql:REL9_6_0:src/backend/utils/errcodes.txt","major":"9.6","parsed_path":"raw/definitions/REL9_6_0.parsed.json","path":"src/backend/utils/errcodes.txt","raw_path":"raw/definitions/REL9_6_0.txt","raw_url":"https://raw.githubusercontent.com/postgres/postgres/a721a1ba9cf6c86cb52f1bf325d5a27b64e870d6/src/backend/utils/errcodes.txt","record_count":244,"release":"9.6.0","release_date":null,"repository":"https://github.com/postgres/postgres.git","sha256":"bf4d94d84c7cfe695cb80e8f009872444574719a80a72e347eb66ef3686b86ef","size":31135,"source_format":"errcodes.txt","source_role":"primary_definition","tag":"REL9_6_0","url":"https://github.com/postgres/postgres/blob/a721a1ba9cf6c86cb52f1bf325d5a27b64e870d6/src/backend/utils/errcodes.txt","version":"9.6.0"},{"blob_id":"sha256:e5d829b24fe63aa69429fa1deb9675051fc8ffd4a8a4651861907a8f12ccb144","channel":"formal","code_count":240,"commit":"5df0e99bea1c3e5fbffa7fbd0982da88ea149bb6","id":"postgresql:REL_10_0:src/backend/utils/errcodes.txt","major":"10","parsed_path":"raw/definitions/REL_10_0.parsed.json","path":"src/backend/utils/errcodes.txt","raw_path":"raw/definitions/REL_10_0.txt","raw_url":"https://raw.githubusercontent.com/postgres/postgres/5df0e99bea1c3e5fbffa7fbd0982da88ea149bb6/src/backend/utils/errcodes.txt","record_count":246,"release":"10.0","release_date":null,"repository":"https://github.com/postgres/postgres.git","sha256":"e5d829b24fe63aa69429fa1deb9675051fc8ffd4a8a4651861907a8f12ccb144","size":31340,"source_format":"errcodes.txt","source_role":"primary_definition","tag":"REL_10_0","url":"https://github.com/postgres/postgres/blob/5df0e99bea1c3e5fbffa7fbd0982da88ea149bb6/src/backend/utils/errcodes.txt","version":"10.0"},{"blob_id":"sha256:8518be6de92ae135765e295c631c5f525120ca2b132453404b620f9aa595cab4","channel":"formal","code_count":241,"commit":"19f20081df059fef87e14c8e953669bd173dd7f1","id":"postgresql:REL_11_0:src/backend/utils/errcodes.txt","major":"11","parsed_path":"raw/definitions/REL_11_0.parsed.json","path":"src/backend/utils/errcodes.txt","raw_path":"raw/definitions/REL_11_0.txt","raw_url":"https://raw.githubusercontent.com/postgres/postgres/19f20081df059fef87e14c8e953669bd173dd7f1/src/backend/utils/errcodes.txt","record_count":247,"release":"11.0","release_date":null,"repository":"https://github.com/postgres/postgres.git","sha256":"8518be6de92ae135765e295c631c5f525120ca2b132453404b620f9aa595cab4","size":31453,"source_format":"errcodes.txt","source_role":"primary_definition","tag":"REL_11_0","url":"https://github.com/postgres/postgres/blob/19f20081df059fef87e14c8e953669bd173dd7f1/src/backend/utils/errcodes.txt","version":"11.0"},{"blob_id":"sha256:943259f3e36af1343dd0f090f7c7cec0e8c762b038d68c178aaa9b1b11999bfb","channel":"formal","code_count":257,"commit":"ad1f2885b8c82e0c2d56d7974f012cbecce17a17","id":"postgresql:REL_12_0:src/backend/utils/errcodes.txt","major":"12","parsed_path":"raw/definitions/REL_12_0.parsed.json","path":"src/backend/utils/errcodes.txt","raw_path":"raw/definitions/REL_12_0.txt","raw_url":"https://raw.githubusercontent.com/postgres/postgres/ad1f2885b8c82e0c2d56d7974f012cbecce17a17/src/backend/utils/errcodes.txt","record_count":263,"release":"12.0","release_date":null,"repository":"https://github.com/postgres/postgres.git","sha256":"943259f3e36af1343dd0f090f7c7cec0e8c762b038d68c178aaa9b1b11999bfb","size":33114,"source_format":"errcodes.txt","source_role":"primary_definition","tag":"REL_12_0","url":"https://github.com/postgres/postgres/blob/ad1f2885b8c82e0c2d56d7974f012cbecce17a17/src/backend/utils/errcodes.txt","version":"12.0"},{"blob_id":"sha256:9a464a3c3c99d2488782d4cdd0d46ce261085a944cb0c21e2d884586fbc8204d","channel":"formal","code_count":258,"commit":"29be9983a64c011eac0b9ee29895cce71e15ea77","id":"postgresql:REL_13_0:src/backend/utils/errcodes.txt","major":"13","parsed_path":"raw/definitions/REL_13_0.parsed.json","path":"src/backend/utils/errcodes.txt","raw_path":"raw/definitions/REL_13_0.txt","raw_url":"https://raw.githubusercontent.com/postgres/postgres/29be9983a64c011eac0b9ee29895cce71e15ea77/src/backend/utils/errcodes.txt","record_count":264,"release":"13.0","release_date":null,"repository":"https://github.com/postgres/postgres.git","sha256":"9a464a3c3c99d2488782d4cdd0d46ce261085a944cb0c21e2d884586fbc8204d","size":33239,"source_format":"errcodes.txt","source_role":"primary_definition","tag":"REL_13_0","url":"https://github.com/postgres/postgres/blob/29be9983a64c011eac0b9ee29895cce71e15ea77/src/backend/utils/errcodes.txt","version":"13.0"},{"blob_id":"sha256:c3c967fa20577f7ded946cb99e1a4706b85bb2476fd32d7e4a133c971a603552","channel":"formal","code_count":259,"commit":"86a4dc1e6f29d1992a2afa3fac1a0b0a6e84568c","id":"postgresql:REL_14_0:src/backend/utils/errcodes.txt","major":"14","parsed_path":"raw/definitions/REL_14_0.parsed.json","path":"src/backend/utils/errcodes.txt","raw_path":"raw/definitions/REL_14_0.txt","raw_url":"https://raw.githubusercontent.com/postgres/postgres/86a4dc1e6f29d1992a2afa3fac1a0b0a6e84568c/src/backend/utils/errcodes.txt","record_count":265,"release":"14.0","release_date":null,"repository":"https://github.com/postgres/postgres.git","sha256":"c3c967fa20577f7ded946cb99e1a4706b85bb2476fd32d7e4a133c971a603552","size":33337,"source_format":"errcodes.txt","source_role":"primary_definition","tag":"REL_14_0","url":"https://github.com/postgres/postgres/blob/86a4dc1e6f29d1992a2afa3fac1a0b0a6e84568c/src/backend/utils/errcodes.txt","version":"14.0"},{"blob_id":"sha256:a34b5fccd8a27c92817314dd942b79e76896cd1d9a8d4be21c81b02227850b4a","channel":"formal","code_count":260,"commit":"2a7ce2e2ce474504a707ec03e128fde66cfb8b48","id":"postgresql:REL_15_0:src/backend/utils/errcodes.txt","major":"15","parsed_path":"raw/definitions/REL_15_0.parsed.json","path":"src/backend/utils/errcodes.txt","raw_path":"raw/definitions/REL_15_0.txt","raw_url":"https://raw.githubusercontent.com/postgres/postgres/2a7ce2e2ce474504a707ec03e128fde66cfb8b48/src/backend/utils/errcodes.txt","record_count":266,"release":"15.0","release_date":null,"repository":"https://github.com/postgres/postgres.git","sha256":"a34b5fccd8a27c92817314dd942b79e76896cd1d9a8d4be21c81b02227850b4a","size":33458,"source_format":"errcodes.txt","source_role":"primary_definition","tag":"REL_15_0","url":"https://github.com/postgres/postgres/blob/2a7ce2e2ce474504a707ec03e128fde66cfb8b48/src/backend/utils/errcodes.txt","version":"15.0"},{"blob_id":"sha256:1d1d741b7b7c6dfd8275287e31c79befed75f3b9349e1a42ef0ca147c429ff88","channel":"formal","code_count":260,"commit":"c372fbbd8e911f2412b80a8c39d7079366565d67","id":"postgresql:REL_16_0:src/backend/utils/errcodes.txt","major":"16","parsed_path":"raw/definitions/REL_16_0.parsed.json","path":"src/backend/utils/errcodes.txt","raw_path":"raw/definitions/REL_16_0.txt","raw_url":"https://raw.githubusercontent.com/postgres/postgres/c372fbbd8e911f2412b80a8c39d7079366565d67/src/backend/utils/errcodes.txt","record_count":266,"release":"16.0","release_date":null,"repository":"https://github.com/postgres/postgres.git","sha256":"1d1d741b7b7c6dfd8275287e31c79befed75f3b9349e1a42ef0ca147c429ff88","size":33458,"source_format":"errcodes.txt","source_role":"primary_definition","tag":"REL_16_0","url":"https://github.com/postgres/postgres/blob/c372fbbd8e911f2412b80a8c39d7079366565d67/src/backend/utils/errcodes.txt","version":"16.0"},{"blob_id":"sha256:bb53279934510355eb4135a807c90d989f07650bd90f87026a4441f11d3296b1","channel":"formal","code_count":260,"commit":"d7ec59a63d745ba74fba0e280bbf85dc6d1caa3e","id":"postgresql:REL_17_0:src/backend/utils/errcodes.txt","major":"17","parsed_path":"raw/definitions/REL_17_0.parsed.json","path":"src/backend/utils/errcodes.txt","raw_path":"raw/definitions/REL_17_0.txt","raw_url":"https://raw.githubusercontent.com/postgres/postgres/d7ec59a63d745ba74fba0e280bbf85dc6d1caa3e/src/backend/utils/errcodes.txt","record_count":266,"release":"17.0","release_date":null,"repository":"https://github.com/postgres/postgres.git","sha256":"bb53279934510355eb4135a807c90d989f07650bd90f87026a4441f11d3296b1","size":33392,"source_format":"errcodes.txt","source_role":"primary_definition","tag":"REL_17_0","url":"https://github.com/postgres/postgres/blob/d7ec59a63d745ba74fba0e280bbf85dc6d1caa3e/src/backend/utils/errcodes.txt","version":"17.0"},{"blob_id":"sha256:6e8de346643ba84aa3c9c6a73360acfc7b2dfb89162c06c08ce9bf5bcd5bbcba","channel":"formal","code_count":262,"commit":"3d6a828938a5fa0444275d3d2f67b64ec3199eb7","id":"postgresql:REL_18_0:src/backend/utils/errcodes.txt","major":"18","parsed_path":"raw/definitions/REL_18_0.parsed.json","path":"src/backend/utils/errcodes.txt","raw_path":"raw/definitions/REL_18_0.txt","raw_url":"https://raw.githubusercontent.com/postgres/postgres/3d6a828938a5fa0444275d3d2f67b64ec3199eb7/src/backend/utils/errcodes.txt","record_count":268,"release":"18.0","release_date":null,"repository":"https://github.com/postgres/postgres.git","sha256":"6e8de346643ba84aa3c9c6a73360acfc7b2dfb89162c06c08ce9bf5bcd5bbcba","size":33739,"source_format":"errcodes.txt","source_role":"primary_definition","tag":"REL_18_0","url":"https://github.com/postgres/postgres/blob/3d6a828938a5fa0444275d3d2f67b64ec3199eb7/src/backend/utils/errcodes.txt","version":"18.0"},{"blob_id":"sha256:cadb9e83cde9a8699a7e74448891ca623af8579ccc8e11c7e533fb47cbc42f89","channel":"preview","code_count":262,"commit":"3638289fb57bdabec00deda98ee9624a35f5d66a","id":"postgresql:REL_19_BETA3:src/backend/utils/errcodes.txt","major":"19","parsed_path":"raw/definitions/REL_19_BETA3.parsed.json","path":"src/backend/utils/errcodes.txt","raw_path":"raw/definitions/REL_19_BETA3.txt","raw_url":"https://raw.githubusercontent.com/postgres/postgres/3638289fb57bdabec00deda98ee9624a35f5d66a/src/backend/utils/errcodes.txt","record_count":268,"release":"19beta3","release_date":"2026-08-13","repository":"https://github.com/postgres/postgres.git","sha256":"cadb9e83cde9a8699a7e74448891ca623af8579ccc8e11c7e533fb47cbc42f89","size":33739,"source_format":"errcodes.txt","source_role":"primary_definition","tag":"REL_19_BETA3","url":"https://github.com/postgres/postgres/blob/3638289fb57bdabec00deda98ee9624a35f5d66a/src/backend/utils/errcodes.txt","version":"19beta3"}],"sqlstate":"P0004","status":"active","usage_evidence":[{"evidence_ids":["postgresql:REL9_5_0:src/backend/utils/errcodes.txt","postgresql:REL9_5_10:src/backend/utils/errcodes.txt","postgresql:REL9_5_11:src/backend/utils/errcodes.txt","postgresql:REL9_5_12:src/backend/utils/errcodes.txt","postgresql:REL9_5_13:src/backend/utils/errcodes.txt","postgresql:REL9_5_14:src/backend/utils/errcodes.txt","postgresql:REL9_5_15:src/backend/utils/errcodes.txt","postgresql:REL9_5_16:src/backend/utils/errcodes.txt","postgresql:REL9_5_17:src/backend/utils/errcodes.txt","postgresql:REL9_5_18:src/backend/utils/errcodes.txt","postgresql:REL9_5_19:src/backend/utils/errcodes.txt","postgresql:REL9_5_1:src/backend/utils/errcodes.txt","postgresql:REL9_5_20:src/backend/utils/errcodes.txt","postgresql:REL9_5_21:src/backend/utils/errcodes.txt","postgresql:REL9_5_22:src/backend/utils/errcodes.txt","postgresql:REL9_5_23:src/backend/utils/errcodes.txt","postgresql:REL9_5_24:src/backend/utils/errcodes.txt","postgresql:REL9_5_25:src/backend/utils/errcodes.txt","postgresql:REL9_5_2:src/backend/utils/errcodes.txt","postgresql:REL9_5_3:src/backend/utils/errcodes.txt","postgresql:REL9_5_4:src/backend/utils/errcodes.txt","postgresql:REL9_5_5:src/backend/utils/errcodes.txt","postgresql:REL9_5_6:src/backend/utils/errcodes.txt","postgresql:REL9_5_7:src/backend/utils/errcodes.txt","postgresql:REL9_5_8:src/backend/utils/errcodes.txt","postgresql:REL9_5_9:src/backend/utils/errcodes.txt","postgresql:REL9_6_0:src/backend/utils/errcodes.txt","postgresql:REL9_6_10:src/backend/utils/errcodes.txt","postgresql:REL9_6_11:src/backend/utils/errcodes.txt","postgresql:REL9_6_12:src/backend/utils/errcodes.txt","postgresql:REL9_6_13:src/backend/utils/errcodes.txt","postgresql:REL9_6_14:src/backend/utils/errcodes.txt","postgresql:REL9_6_15:src/backend/utils/errcodes.txt","postgresql:REL9_6_16:src/backend/utils/errcodes.txt","postgresql:REL9_6_17:src/backend/utils/errcodes.txt","postgresql:REL9_6_18:src/backend/utils/errcodes.txt","postgresql:REL9_6_19:src/backend/utils/errcodes.txt","postgresql:REL9_6_1:src/backend/utils/errcodes.txt","postgresql:REL9_6_20:src/backend/utils/errcodes.txt","postgresql:REL9_6_21:src/backend/utils/errcodes.txt","postgresql:REL9_6_22:src/backend/utils/errcodes.txt","postgresql:REL9_6_23:src/backend/utils/errcodes.txt","postgresql:REL9_6_24:src/backend/utils/errcodes.txt","postgresql:REL9_6_2:src/backend/utils/errcodes.txt","postgresql:REL9_6_3:src/backend/utils/errcodes.txt","postgresql:REL9_6_4:src/backend/utils/errcodes.txt","postgresql:REL9_6_5:src/backend/utils/errcodes.txt","postgresql:REL9_6_6:src/backend/utils/errcodes.txt","postgresql:REL9_6_7:src/backend/utils/errcodes.txt","postgresql:REL9_6_8:src/backend/utils/errcodes.txt","postgresql:REL9_6_9:src/backend/utils/errcodes.txt","postgresql:REL_10_0:src/backend/utils/errcodes.txt","postgresql:REL_10_10:src/backend/utils/errcodes.txt","postgresql:REL_10_11:src/backend/utils/errcodes.txt","postgresql:REL_10_12:src/backend/utils/errcodes.txt","postgresql:REL_10_13:src/backend/utils/errcodes.txt","postgresql:REL_10_14:src/backend/utils/errcodes.txt","postgresql:REL_10_15:src/backend/utils/errcodes.txt","postgresql:REL_10_16:src/backend/utils/errcodes.txt","postgresql:REL_10_17:src/backend/utils/errcodes.txt","postgresql:REL_10_18:src/backend/utils/errcodes.txt","postgresql:REL_10_19:src/backend/utils/errcodes.txt","postgresql:REL_10_1:src/backend/utils/errcodes.txt","postgresql:REL_10_20:src/backend/utils/errcodes.txt","postgresql:REL_10_21:src/backend/utils/errcodes.txt","postgresql:REL_10_22:src/backend/utils/errcodes.txt","postgresql:REL_10_23:src/backend/utils/errcodes.txt","postgresql:REL_10_2:src/backend/utils/errcodes.txt","postgresql:REL_10_3:src/backend/utils/errcodes.txt","postgresql:REL_10_4:src/backend/utils/errcodes.txt","postgresql:REL_10_5:src/backend/utils/errcodes.txt","postgresql:REL_10_6:src/backend/utils/errcodes.txt","postgresql:REL_10_7:src/backend/utils/errcodes.txt","postgresql:REL_10_8:src/backend/utils/errcodes.txt","postgresql:REL_10_9:src/backend/utils/errcodes.txt","postgresql:REL_11_0:src/backend/utils/errcodes.txt","postgresql:REL_11_10:src/backend/utils/errcodes.txt","postgresql:REL_11_11:src/backend/utils/errcodes.txt","postgresql:REL_11_12:src/backend/utils/errcodes.txt","postgresql:REL_11_13:src/backend/utils/errcodes.txt","postgresql:REL_11_14:src/backend/utils/errcodes.txt","postgresql:REL_11_15:src/backend/utils/errcodes.txt","postgresql:REL_11_16:src/backend/utils/errcodes.txt","postgresql:REL_11_17:src/backend/utils/errcodes.txt","postgresql:REL_11_18:src/backend/utils/errcodes.txt","postgresql:REL_11_19:src/backend/utils/errcodes.txt","postgresql:REL_11_1:src/backend/utils/errcodes.txt","postgresql:REL_11_20:src/backend/utils/errcodes.txt","postgresql:REL_11_21:src/backend/utils/errcodes.txt","postgresql:REL_11_22:src/backend/utils/errcodes.txt","postgresql:REL_11_2:src/backend/utils/errcodes.txt","postgresql:REL_11_3:src/backend/utils/errcodes.txt","postgresql:REL_11_4:src/backend/utils/errcodes.txt","postgresql:REL_11_5:src/backend/utils/errcodes.txt","postgresql:REL_11_6:src/backend/utils/errcodes.txt","postgresql:REL_11_7:src/backend/utils/errcodes.txt","postgresql:REL_11_8:src/backend/utils/errcodes.txt","postgresql:REL_11_9:src/backend/utils/errcodes.txt","postgresql:REL_12_0:src/backend/utils/errcodes.txt","postgresql:REL_12_10:src/backend/utils/errcodes.txt","postgresql:REL_12_11:src/backend/utils/errcodes.txt","postgresql:REL_12_12:src/backend/utils/errcodes.txt","postgresql:REL_12_13:src/backend/utils/errcodes.txt","postgresql:REL_12_14:src/backend/utils/errcodes.txt","postgresql:REL_12_15:src/backend/utils/errcodes.txt","postgresql:REL_12_16:src/backend/utils/errcodes.txt","postgresql:REL_12_17:src/backend/utils/errcodes.txt","postgresql:REL_12_18:src/backend/utils/errcodes.txt","postgresql:REL_12_19:src/backend/utils/errcodes.txt","postgresql:REL_12_1:src/backend/utils/errcodes.txt","postgresql:REL_12_20:src/backend/utils/errcodes.txt","postgresql:REL_12_21:src/backend/utils/errcodes.txt","postgresql:REL_12_22:src/backend/utils/errcodes.txt","postgresql:REL_12_2:src/backend/utils/errcodes.txt","postgresql:REL_12_3:src/backend/utils/errcodes.txt","postgresql:REL_12_4:src/backend/utils/errcodes.txt","postgresql:REL_12_5:src/backend/utils/errcodes.txt","postgresql:REL_12_6:src/backend/utils/errcodes.txt","postgresql:REL_12_7:src/backend/utils/errcodes.txt","postgresql:REL_12_8:src/backend/utils/errcodes.txt","postgresql:REL_12_9:src/backend/utils/errcodes.txt","postgresql:REL_13_0:src/backend/utils/errcodes.txt","postgresql:REL_13_10:src/backend/utils/errcodes.txt","postgresql:REL_13_11:src/backend/utils/errcodes.txt","postgresql:REL_13_12:src/backend/utils/errcodes.txt","postgresql:REL_13_13:src/backend/utils/errcodes.txt","postgresql:REL_13_14:src/backend/utils/errcodes.txt","postgresql:REL_13_15:src/backend/utils/errcodes.txt","postgresql:REL_13_16:src/backend/utils/errcodes.txt","postgresql:REL_13_17:src/backend/utils/errcodes.txt","postgresql:REL_13_18:src/backend/utils/errcodes.txt","postgresql:REL_13_19:src/backend/utils/errcodes.txt","postgresql:REL_13_1:src/backend/utils/errcodes.txt","postgresql:REL_13_20:src/backend/utils/errcodes.txt","postgresql:REL_13_21:src/backend/utils/errcodes.txt","postgresql:REL_13_22:src/backend/utils/errcodes.txt","postgresql:REL_13_23:src/backend/utils/errcodes.txt","postgresql:REL_13_2:src/backend/utils/errcodes.txt","postgresql:REL_13_3:src/backend/utils/errcodes.txt","postgresql:REL_13_4:src/backend/utils/errcodes.txt","postgresql:REL_13_5:src/backend/utils/errcodes.txt","postgresql:REL_13_6:src/backend/utils/errcodes.txt","postgresql:REL_13_7:src/backend/utils/errcodes.txt","postgresql:REL_13_8:src/backend/utils/errcodes.txt","postgresql:REL_13_9:src/backend/utils/errcodes.txt","postgresql:REL_14_0:src/backend/utils/errcodes.txt","postgresql:REL_14_10:src/backend/utils/errcodes.txt","postgresql:REL_14_11:src/backend/utils/errcodes.txt","postgresql:REL_14_12:src/backend/utils/errcodes.txt","postgresql:REL_14_13:src/backend/utils/errcodes.txt","postgresql:REL_14_14:src/backend/utils/errcodes.txt","postgresql:REL_14_15:src/backend/utils/errcodes.txt","postgresql:REL_14_16:src/backend/utils/errcodes.txt","postgresql:REL_14_17:src/backend/utils/errcodes.txt","postgresql:REL_14_18:src/backend/utils/errcodes.txt","postgresql:REL_14_19:src/backend/utils/errcodes.txt","postgresql:REL_14_1:src/backend/utils/errcodes.txt","postgresql:REL_14_20:src/backend/utils/errcodes.txt","postgresql:REL_14_21:src/backend/utils/errcodes.txt","postgresql:REL_14_22:src/backend/utils/errcodes.txt","postgresql:REL_14_23:src/backend/utils/errcodes.txt","postgresql:REL_14_24:src/backend/utils/errcodes.txt","postgresql:REL_14_2:src/backend/utils/errcodes.txt","postgresql:REL_14_3:src/backend/utils/errcodes.txt","postgresql:REL_14_4:src/backend/utils/errcodes.txt","postgresql:REL_14_5:src/backend/utils/errcodes.txt","postgresql:REL_14_6:src/backend/utils/errcodes.txt","postgresql:REL_14_7:src/backend/utils/errcodes.txt","postgresql:REL_14_8:src/backend/utils/errcodes.txt","postgresql:REL_14_9:src/backend/utils/errcodes.txt","postgresql:REL_15_0:src/backend/utils/errcodes.txt","postgresql:REL_15_10:src/backend/utils/errcodes.txt","postgresql:REL_15_11:src/backend/utils/errcodes.txt","postgresql:REL_15_12:src/backend/utils/errcodes.txt","postgresql:REL_15_13:src/backend/utils/errcodes.txt","postgresql:REL_15_14:src/backend/utils/errcodes.txt","postgresql:REL_15_15:src/backend/utils/errcodes.txt","postgresql:REL_15_16:src/backend/utils/errcodes.txt","postgresql:REL_15_17:src/backend/utils/errcodes.txt","postgresql:REL_15_18:src/backend/utils/errcodes.txt","postgresql:REL_15_19:src/backend/utils/errcodes.txt","postgresql:REL_15_1:src/backend/utils/errcodes.txt","postgresql:REL_15_2:src/backend/utils/errcodes.txt","postgresql:REL_15_3:src/backend/utils/errcodes.txt","postgresql:REL_15_4:src/backend/utils/errcodes.txt","postgresql:REL_15_5:src/backend/utils/errcodes.txt","postgresql:REL_15_6:src/backend/utils/errcodes.txt","postgresql:REL_15_7:src/backend/utils/errcodes.txt","postgresql:REL_15_8:src/backend/utils/errcodes.txt","postgresql:REL_15_9:src/backend/utils/errcodes.txt","postgresql:REL_16_0:src/backend/utils/errcodes.txt","postgresql:REL_16_10:src/backend/utils/errcodes.txt","postgresql:REL_16_11:src/backend/utils/errcodes.txt","postgresql:REL_16_12:src/backend/utils/errcodes.txt","postgresql:REL_16_13:src/backend/utils/errcodes.txt","postgresql:REL_16_14:src/backend/utils/errcodes.txt","postgresql:REL_16_15:src/backend/utils/errcodes.txt","postgresql:REL_16_1:src/backend/utils/errcodes.txt","postgresql:REL_16_2:src/backend/utils/errcodes.txt","postgresql:REL_16_3:src/backend/utils/errcodes.txt","postgresql:REL_16_4:src/backend/utils/errcodes.txt","postgresql:REL_16_5:src/backend/utils/errcodes.txt","postgresql:REL_16_6:src/backend/utils/errcodes.txt","postgresql:REL_16_7:src/backend/utils/errcodes.txt","postgresql:REL_16_8:src/backend/utils/errcodes.txt","postgresql:REL_16_9:src/backend/utils/errcodes.txt","postgresql:REL_17_0:src/backend/utils/errcodes.txt","postgresql:REL_17_10:src/backend/utils/errcodes.txt","postgresql:REL_17_11:src/backend/utils/errcodes.txt","postgresql:REL_17_1:src/backend/utils/errcodes.txt","postgresql:REL_17_2:src/backend/utils/errcodes.txt","postgresql:REL_17_3:src/backend/utils/errcodes.txt","postgresql:REL_17_4:src/backend/utils/errcodes.txt","postgresql:REL_17_5:src/backend/utils/errcodes.txt","postgresql:REL_17_6:src/backend/utils/errcodes.txt","postgresql:REL_17_7:src/backend/utils/errcodes.txt","postgresql:REL_17_8:src/backend/utils/errcodes.txt","postgresql:REL_17_9:src/backend/utils/errcodes.txt","postgresql:REL_18_0:src/backend/utils/errcodes.txt","postgresql:REL_18_1:src/backend/utils/errcodes.txt","postgresql:REL_18_2:src/backend/utils/errcodes.txt","postgresql:REL_18_3:src/backend/utils/errcodes.txt","postgresql:REL_18_4:src/backend/utils/errcodes.txt","postgresql:REL_18_6:src/backend/utils/errcodes.txt","postgresql:REL_19_BETA3:src/backend/utils/errcodes.txt"],"notes":"Presence in a PostgreSQL release definition file is established; runtime throw/use scanning is maintained separately.","scope":"release-definition-catalogue","status":"definition_only"},{"evidence_ids":[],"notes":"No occurrence was found in the locked 7.4..8.4 definition files; 7.0..7.3 source gaps remain explicit.","scope":"pre9-definition-history","status":"unknown"}]},"Evidence":[{"Kind":"cases","Ordinal":0,"ID":"assertion_failure_recovery","ServerVersion":null,"Status":null,"Payload":{"assertions":["The natural ASSERT failure has SQLSTATE P0004 and the expected diagnostic.","The failed explicit transaction is INERROR and ROLLBACK returns it to IDLE.","A valid call succeeds after rollback, and an explicit check_asserts=off control suppresses the assertion.","Re-enabling check_asserts makes the valid call succeed and the runner cleans up."],"case_id":"assertion_failure_recovery","cleanup":"Drop the case schema with an owner connection.","has_snippet":true,"position":0,"preconditions":["A disposable runner target has PL/pgSQL available.","plpgsql.check_asserts is explicitly enabled before the trigger."],"repair":"Rollback the failed transaction, use a valid input, and keep assertions enabled for production behavior.","trigger":"Call a PL/pgSQL function whose ASSERT condition is false inside an explicit transaction.","versions":["10","18"]}},{"Kind":"claims","Ordinal":0,"ID":"identity","ServerVersion":null,"Status":null,"Payload":{"claim_id":"identity","limits":"","method":"Read the fixed definition row.","position":0,"runtime":[],"sources":["src.errcodes.18.6"],"statement":"P0004 is assert_failure in PostgreSQL-specific Class P0."}},{"Kind":"claims","Ordinal":1,"ID":"assert-path","ServerVersion":null,"Status":null,"Payload":{"claim_id":"assert-path","limits":"","method":"Read the fixed `ASSERT` execution path and both errmsg branches.","position":1,"runtime":[],"sources":["src.path.plpgsql"],"statement":"PL/pgSQL assertion execution reports P0004 at ERROR level, using the evaluated message when present and `assertion failed` when no message is supplied."}},{"Kind":"claims","Ordinal":2,"ID":"runtime.assertion-case","ServerVersion":null,"Status":null,"Payload":{"claim_id":"runtime.assertion-case","limits":"This is a bounded case for the shared function and ASSERT setting; it does not establish behavior for arbitrary assertion messages or non-PL/pgSQL code.","method":"Read both target summaries and the fixed snippet registry.","position":2,"runtime":[],"sources":["runtime.P0004-same-session-latest-final.latest","runtime.P0004-same-session-pg10-final.pg10","snippet-registry.P0004"],"statement":"The shared assertion_failure_recovery case passed on PostgreSQL 18.6 and PostgreSQL 10.21: the false ASSERT returned P0004 with value must be positive, the explicit transaction was INERROR until ROLLBACK, a valid input succeeded, and the disabled-assert control returned zero."}},{"Kind":"claims","Ordinal":3,"ID":"runtime.diagnostics","ServerVersion":null,"Status":null,"Payload":{"claim_id":"runtime.diagnostics","limits":"","method":"Compare structured diagnostics in both target summaries.","position":3,"runtime":[],"sources":["runtime.P0004-same-session-latest-final.latest","runtime.P0004-same-session-pg10-final.pg10"],"statement":"The latest target recorded ERROR/P0004 from exec_stmt_assert at pl_exec.c:3968 with context at ASSERT; the PG10 target recorded the same SQLSTATE and diagnostic with its version-specific source line."}},{"Kind":"claims","Ordinal":4,"ID":"assert-semantics","ServerVersion":null,"Status":null,"Payload":{"claim_id":"assert-semantics","limits":"","method":"Read the fixed executor branch and the official PL/pgSQL ASSERT documentation.","position":4,"runtime":[],"sources":["src.path.plpgsql","doc.plpgsql.18"],"statement":"The fixed PL/pgSQL ASSERT path reports P0004 when its Boolean condition evaluates false or NULL; the supplied message expression is used as primary text, otherwise the executor uses assertion failed."}},{"Kind":"claims","Ordinal":5,"ID":"settings-and-handler-boundary","ServerVersion":null,"Status":null,"Payload":{"claim_id":"settings-and-handler-boundary","limits":"The setting is session-scoped; this claim does not make a connection-level setting change global.","method":"Read the PL/pgSQL control-structures error-trapping section for EXCEPTION subtransactions and condition matching; read the fixed executor for the session setting boundary.","position":5,"runtime":[],"sources":["doc.plpgsql-control.18","src.path.plpgsql"],"statement":"plpgsql.check_asserts controls assertion checking for the session, and the PL/pgSQL handler rules exclude ASSERT_FAILURE from WHEN OTHERS while allowing a named ASSERT_FAILURE condition."}},{"Kind":"claims","Ordinal":6,"ID":"transaction-recovery","ServerVersion":null,"Status":null,"Payload":{"claim_id":"transaction-recovery","limits":"","method":"Read both passed target summaries and the ordered shared registry.","position":6,"runtime":[],"sources":["runtime.P0004-same-session-latest-final.latest","runtime.P0004-same-session-pg10-final.pg10","snippet-registry.P0004"],"statement":"The observed case entered INERROR after P0004, returned to IDLE after ROLLBACK, and then accepted a valid call; disabling check_asserts suppressed the false assertion in the control branch."}},{"Kind":"messages","Ordinal":0,"ID":"message.assert","ServerVersion":null,"Status":null,"Payload":{"limits":"","message_id":"message.assert","path":"","position":0,"raw":{"alternate_template":"%s","id":"message.assert","primary_template":"assertion failed","severity_source":"ERROR","sources":["src.path.plpgsql"],"sqlstate":"P0004"},"severity":"ERROR","sources":["src.path.plpgsql"],"templates":[{"kind":"primary","literal":"assertion failed","position":0,"role":"","template":"assertion failed"},{"kind":"primary","literal":"","position":1,"role":"alternate","template":"%s"}]}},{"Kind":"runtimes","Ordinal":0,"ID":"runtime.P0004-same-session-latest-final.latest","ServerVersion":"18.6 (Homebrew)","Status":"passed","Payload":{"cases":["assertion_failure_recovery"],"limits":"","position":0,"raw":{"cases":["assertion_failure_recovery"],"id":"runtime.P0004-same-session-latest-final.latest","observed":{"after_error":"INERROR","after_rollback":"IDLE","disabled_control_result":0,"message_primary":"value must be positive","repair_result":1,"severity":"ERROR","sqlstate":"P0004"},"raw":"verify/results/P0004-same-session-latest-final/latest/raw.jsonl","raw_sha256":"2b03b5469ea34a0e49ad4a71e93cef4b19df0d01d86fc1156e478d88bc93168c","run_id":"P0004-same-session-latest-final","server_version":"18.6 (Homebrew)","server_version_num":180006,"status":"passed","summary":"verify/results/P0004-same-session-latest-final/latest/summary.json","summary_sha256":"5246ae67ee8dd29e769c3a03db7bfb6cde2f201c9f45993201fb269cc53988ad","target":"latest"},"run_id":"P0004-same-session-latest-final","runtime_id":"runtime.P0004-same-session-latest-final.latest","server_version":"18.6 (Homebrew)","status":"passed","target":"latest"}},{"Kind":"runtimes","Ordinal":1,"ID":"runtime.P0004-same-session-pg10-final.pg10","ServerVersion":"10.21 (Debian 10.21-1.pgdg90+1)","Status":"passed","Payload":{"cases":["assertion_failure_recovery"],"limits":"","position":1,"raw":{"cases":["assertion_failure_recovery"],"id":"runtime.P0004-same-session-pg10-final.pg10","observed":{"after_error":"INERROR","after_rollback":"IDLE","disabled_control_result":0,"message_primary":"value must be positive","repair_result":1,"severity":"ERROR","sqlstate":"P0004"},"raw":"verify/results/P0004-same-session-pg10-final/pg10/raw.jsonl","raw_sha256":"2369b62eb7c22d99122c9929134a878f2f3c0fe828887ae657f87b7b95e07ac8","run_id":"P0004-same-session-pg10-final","server_version":"10.21 (Debian 10.21-1.pgdg90+1)","server_version_num":100021,"status":"passed","summary":"verify/results/P0004-same-session-pg10-final/pg10/summary.json","summary_sha256":"50819f9620584f17766ffb62e2bb1c14e5aaa9162f91ec6cd26795cced3e6d30","target":"pg10"},"run_id":"P0004-same-session-pg10-final","runtime_id":"runtime.P0004-same-session-pg10-final.pg10","server_version":"10.21 (Debian 10.21-1.pgdg90+1)","status":"passed","target":"pg10"}},{"Kind":"sources","Ordinal":0,"ID":"src.errcodes.18.6","ServerVersion":null,"Status":null,"Payload":{"commit":"724edf9bde9d356724ad384a2e196edc3c9f80f7","docs_url":"","kind":"upstream_source","location":"","path":"src/backend/utils/errcodes.txt","position":0,"sha256":"6e8de346643ba84aa3c9c6a73360acfc7b2dfb89162c06c08ce9bf5bcd5bbcba","source_id":"src.errcodes.18.6","tag":"REL_18_6","url":"https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/utils/errcodes.txt#L494"}},{"Kind":"sources","Ordinal":1,"ID":"src.calls.REL_18_6","ServerVersion":null,"Status":null,"Payload":{"commit":"","docs_url":"","kind":"local_artifact","location":"","path":"raw/calls/REL_18_6.jsonl","position":1,"sha256":"9ee8a0e81d8f0825c5c1ae45583439859a26e602bdd4ce2f2a62aa278867ccbf","source_id":"src.calls.REL_18_6","tag":"","url":""}},{"Kind":"sources","Ordinal":2,"ID":"src.path.plpgsql","ServerVersion":null,"Status":null,"Payload":{"commit":"724edf9bde9d356724ad384a2e196edc3c9f80f7","docs_url":"","kind":"upstream_source","location":"","path":"src/pl/plpgsql/src/pl_exec.c","position":2,"sha256":"0df3c70a6bccf6dddf443fb99e152a16a67009827c44a820597e98e585cb8b20","source_id":"src.path.plpgsql","tag":"REL_18_6","url":"https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/pl/plpgsql/src/pl_exec.c#L3965-L3968"}},{"Kind":"sources","Ordinal":3,"ID":"runtime.P0004-same-session-latest-final.latest","ServerVersion":null,"Status":null,"Payload":{"commit":"","docs_url":"","kind":"local_artifact","location":"","path":"verify/results/P0004-same-session-latest-final/latest/summary.json","position":3,"sha256":"5246ae67ee8dd29e769c3a03db7bfb6cde2f201c9f45993201fb269cc53988ad","source_id":"runtime.P0004-same-session-latest-final.latest","tag":"","url":""}},{"Kind":"sources","Ordinal":4,"ID":"runtime.P0004-same-session-latest-final.latest.raw","ServerVersion":null,"Status":null,"Payload":{"commit":"","docs_url":"","kind":"local_artifact","location":"","path":"verify/results/P0004-same-session-latest-final/latest/raw.jsonl","position":4,"sha256":"2b03b5469ea34a0e49ad4a71e93cef4b19df0d01d86fc1156e478d88bc93168c","source_id":"runtime.P0004-same-session-latest-final.latest.raw","tag":"","url":""}},{"Kind":"sources","Ordinal":5,"ID":"runtime.P0004-same-session-pg10-final.pg10","ServerVersion":null,"Status":null,"Payload":{"commit":"","docs_url":"","kind":"local_artifact","location":"","path":"verify/results/P0004-same-session-pg10-final/pg10/summary.json","position":5,"sha256":"50819f9620584f17766ffb62e2bb1c14e5aaa9162f91ec6cd26795cced3e6d30","source_id":"runtime.P0004-same-session-pg10-final.pg10","tag":"","url":""}},{"Kind":"sources","Ordinal":6,"ID":"runtime.P0004-same-session-pg10-final.pg10.raw","ServerVersion":null,"Status":null,"Payload":{"commit":"","docs_url":"","kind":"local_artifact","location":"","path":"verify/results/P0004-same-session-pg10-final/pg10/raw.jsonl","position":6,"sha256":"2369b62eb7c22d99122c9929134a878f2f3c0fe828887ae657f87b7b95e07ac8","source_id":"runtime.P0004-same-session-pg10-final.pg10.raw","tag":"","url":""}},{"Kind":"sources","Ordinal":7,"ID":"snippet-registry.P0004","ServerVersion":null,"Status":null,"Payload":{"commit":"","docs_url":"","kind":"local_artifact","location":"","path":"verify/cases/P0004/snippets.json","position":7,"sha256":"ef124f75ec61be666abc87ff431ebfb496dfa3352f78a3bee4432430dd68c229","source_id":"snippet-registry.P0004","tag":"","url":""}},{"Kind":"sources","Ordinal":8,"ID":"doc.plpgsql.18","ServerVersion":null,"Status":null,"Payload":{"commit":"724edf9bde9d356724ad384a2e196edc3c9f80f7","docs_url":"","kind":"upstream_source","location":"","path":"doc/src/sgml/plpgsql.sgml","position":8,"sha256":"43d705adbded343336341fd3e34ea8940432e8a8211f737d36ba3041ad0a4a51","source_id":"doc.plpgsql.18","tag":"PG18-docs","url":"https://www.postgresql.org/docs/18/plpgsql-errors-and-messages.html"}},{"Kind":"sources","Ordinal":9,"ID":"doc.plpgsql-control.18","ServerVersion":null,"Status":null,"Payload":{"commit":"724edf9bde9d356724ad384a2e196edc3c9f80f7","docs_url":"","kind":"upstream_source","location":"","path":"doc/src/sgml/plpgsql.sgml","position":9,"sha256":"43d705adbded343336341fd3e34ea8940432e8a8211f737d36ba3041ad0a4a51","source_id":"doc.plpgsql-control.18","tag":"PG18-docs","url":"https://www.postgresql.org/docs/18/plpgsql-control-structures.html#PLPGSQL-ERROR-TRAPPING"}}]}
