↑↓ 选择↵ 打开⌫ 切换范围完整搜索

PG.CENTER 连接 PostgreSQL 文档、百科与生态知识。由 Pigsty 维护。

Wiki / SQLSTATE

2202G — invalid_tablesample_repeat

TABLESAMPLE 的 REPEATABLE 种子不能为空。

英文手册覆盖始于 PostgreSQL 8.1. 来源历史与运行验证各自保留独立版本边界。

当前阅读 PG 18·选择有来源记录的版本

aliases
未知
class name
Data Exception
condition name
invalid_tablesample_repeat
lang
en
sqlstate
2202G

版本定义 PG 18

2202G

速览 {#at-a-glance}

TABLESAMPLE 的 REPEATABLE seed 为 NULL 时无效。固定执行器路径报告 TABLESAMPLE REPEATABLE parameter cannot be null。

报文 {#messages}

执行器守卫使用以下首要文本:

| 守卫 | 首要文本 | | --- | --- | | REPEATABLE 表达式为 NULL | TABLESAMPLE REPEATABLE parameter cannot be null |

含义 {#meaning}

在 tablesample_init 中,PostgreSQL 先求值每个 TABLESAMPLE 方法参数;参数为 NULL 时报告 2202H。随后它单独求值可选的 REPEATABLE 表达式;结果为 NULL 时进入 2202G。非 NULL 的 REPEATABLE 值已由解析器转换为 float8,再用 hashfloat8 生成采样 seed。因此本码覆盖重复采样 seed 为 NULL 的约束,不覆盖负 seed 或方法百分比范围。

诊断 {#diagnosis}

检查 REPEATABLE 表达式的实际求值结果,包括可能变成 SQL NULL 的参数或函数。区分 TABLESAMPLE 方法参数为 NULL 的 2202H,以及非 NULL 但百分比、数量或时间无效且由选定方法校验的情况。首要报文可以确认是重复 seed 分支。

处理 {#response}

为 REPEATABLE 提供非 NULL 表达式;如果不需要确定性重复,也可以省略该子句。若方法参数触发 2202H,应单独修正该参数。如果 ERROR 发生在显式事务中,应先 ROLLBACK 或回滚到既有保存点再重试;自动提交可重试修正后的语句。

版本 {#versions}

锁定目录从 9.5.0 起记录该条件;本页固定源码路径为 PostgreSQL 18.6。未声称本页有自然运行观察。

相关 {#related}

2202H、22004

来源 {#sources}

执行器在 src/backend/executor/nodeSamplescan.c#L232-267 中先求值方法参数,再求值可选的 repeat 表达式。结构化证据记录保留 2202G 守卫及其与 2202H 的边界;本页未运行自然案例。

比较版本

SQLSTATE 证据与已记录的运行版本

claims · identity
{
  "claim_id": "identity",
  "limits": "",
  "method": "Read fixed definition.",
  "position": 0,
  "runtime": [],
  "sources": [
    "src.errcodes.18.6"
  ],
  "statement": "2202G is invalid_tablesample_repeat in SQLSTATE Class 22."
}
claims · resolved-path
{
  "claim_id": "resolved-path",
  "limits": "Source confirmation is not natural runtime.",
  "method": "Read the complete fixed source context.",
  "position": 1,
  "runtime": [],
  "sources": [
    "src.path.0"
  ],
  "statement": "Fixed source supports the representative 2202G path described."
}
claims · history
{
  "claim_id": "history",
  "limits": "",
  "method": "Use catalogue boundary.",
  "position": 2,
  "runtime": [],
  "sources": [
    "src.errcodes.18.6"
  ],
  "statement": "The locked catalogue records 2202G from 9.5.0 without proving exact implementation introduction."
}
messages · message.0
{
  "limits": "",
  "message_id": "message.0",
  "path": "",
  "position": 0,
  "raw": {
    "id": "message.0",
    "primary_template": "TABLESAMPLE REPEATABLE parameter cannot be null",
    "severity_source": "ERROR",
    "sources": [
      "src.path.0"
    ],
    "sqlstate": "2202G"
  },
  "severity": "ERROR",
  "sources": [
    "src.path.0"
  ],
  "templates": [
    {
      "kind": "primary",
      "literal": "TABLESAMPLE REPEATABLE parameter cannot be null",
      "position": 0,
      "role": "",
      "template": "TABLESAMPLE REPEATABLE parameter cannot be null"
    }
  ]
}
sources · src.errcodes.18.6
{
  "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#L191"
}
sources · src.path.0
{
  "commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
  "docs_url": "",
  "kind": "upstream_source",
  "location": "",
  "path": "src/backend/executor/nodeSamplescan.c",
  "position": 1,
  "sha256": "59ddce276a131990661664393bf645d62693a722f382bd040f6b1c2584e7b2a5",
  "source_id": "src.path.0",
  "tag": "REL_18_6",
  "url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/executor/nodeSamplescan.c#L254"
}

来源引用

完整定义与证据 JSON

定义来源

center · PostgreSQL 18 · english-manuals:8089c1baa70237500965dc3647843a3ae0d42c903b31570646e6a84750dc4ca0

正文语言: zh-Hans · english-manuals:8089c1baa70237500965dc3647843a3ae0d42c903b31570646e6a84750dc4ca0