> ## Documentation Index
> Fetch the complete documentation index at: https://private-7c7dfe99-parallel-read-in-order-multi-part.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# validate_* 会话设置

> 自动生成的 validate_* 组中的 ClickHouse 会话设置。

export const VersionHistory = ({rows = []}) => {
  if (rows.length === 0) {
    return null;
  }
  const headers = ["版本", "默认值", "注释"];
  const border = "1px solid rgba(128, 128, 128, 0.3)";
  const cell = {
    border,
    padding: "0.25rem 0.5rem",
    textAlign: "start",
    verticalAlign: "top"
  };
  return <details className="not-prose" style={{
    border,
    borderRadius: "0.5rem",
    margin: "0.5rem 0",
    padding: "0.5rem 0.75rem",
    fontSize: "0.8125rem",
    lineHeight: "1.125rem"
  }}>
      <summary style={{
    cursor: "pointer",
    fontWeight: 600,
    opacity: 0.72
  }}>
        版本历史
      </summary>
      <table style={{
    borderCollapse: "collapse",
    width: "100%",
    margin: "0.5rem 0 0"
  }}>
        <thead>
          <tr>
            {headers.map(header => <th key={header} style={{
    ...cell,
    fontWeight: 600,
    opacity: 0.72
  }}>
                {header}
              </th>)}
          </tr>
        </thead>
        <tbody>
          {rows.map((row, row_index) => <tr key={row.id ?? row_index}>
              {(row.items ?? []).map((item, item_index) => <td key={item_index} style={{
    ...cell,
    overflowWrap: "anywhere"
  }}>
                  {item?.label}
                </td>)}
            </tr>)}
        </tbody>
      </table>
    </details>;
};

export const SettingsInfoBlock = ({type, default_value, changeable_without_restart}) => {
  return <div className="not-prose" style={{
    display: "flex",
    flexWrap: "wrap",
    alignItems: "baseline",
    columnGap: "0.5rem",
    rowGap: "0.125rem",
    margin: "0.375rem 0",
    fontSize: "0.8125rem",
    lineHeight: "1.125rem"
  }}>
      <div style={{
    fontWeight: 600,
    opacity: 0.72
  }}>类型</div>
      <div style={{
    overflowWrap: "anywhere"
  }}>{type}</div>
      <div style={{
    fontWeight: 600,
    opacity: 0.72,
    marginInlineStart: "0.5rem"
  }}>默认值</div>
      <div style={{
    overflowWrap: "anywhere"
  }}>{default_value}</div>
      {changeable_without_restart && <div style={{
    fontWeight: 600,
    opacity: 0.72,
    marginInlineStart: "0.5rem"
  }}>
          无需重启即可更改
        </div>}
      {changeable_without_restart && <div style={{
    overflowWrap: "anywhere"
  }}>
          {changeable_without_restart}
        </div>}
    </div>;
};

这些设置可在 [system.settings](/zh/reference/system-tables/settings) 中查看，并由 [源代码](https://github.com/ClickHouse/ClickHouse/blob/master/src/Core/Settings.cpp) 自动生成。

<h2 id="validate_enum_literals_in_operators">
  validate\_enum\_literals\_in\_operators
</h2>

<SettingsInfoBlock type="Bool" default_value="0" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.1"},{"label": "0"},{"label": "新增设置"}]}]} />

启用后，会根据枚举类型检查 `IN`、`NOT IN`、`==` 和 `!=` 等运算符中的枚举字面量；如果字面量不是有效的枚举值，则抛出异常。

<h2 id="validate_group_by_all_key_types">
  validate\_group\_by\_all\_key\_types
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.9"},{"label": "1"},{"label": "对 `GROUP BY ALL` 展开 `SELECT` expressions 后所得 key types 的验证，在 `compatibility` 设置为 26.7 或 26.8 时保持不变：先前的值特意设为与新值相同，因为这些版本已经拒绝此类 key；只有 `compatibility` 设置为 26.7 之前的版本，才会恢复此前的接受行为。"}]}, {"id": "row-2","items": [{"label": "26.7"},{"label": "1"},{"label": "新增设置，用于控制对 `GROUP BY ALL` 展开 `SELECT` expressions 后所得 key types 的验证。26.7 开始拒绝此处的 `Variant`\/`Dynamic` key，而较早版本在启用 analyzer 时会接受此类 key（`enable_analyzer = 1`，即默认值；旧 analyzer 在 26.7 之前也会拒绝此类 key），因此先前的值为 `false`，将 `compatibility` 设置为 26.7 之前的版本可恢复此前的接受行为。"}]}]} />

控制是否依据 [allow\_suspicious\_types\_in\_group\_by](/zh/reference/settings/session-settings/allow-suspicious#allow_suspicious_types_in_group_by) 检查 `GROUP BY ALL` 展开 `SELECT` expressions 后所得的 grouping keys。禁用此设置可恢复 26.7 之前版本的行为：这些版本会接受写为 `GROUP BY ALL` 的 [Variant](/zh/reference/data-types/variant) 或 [Dynamic](/zh/reference/data-types/dynamic) key，例如未指定类型的 JSON subpath 作为 grouping key。仅在启用 analyzer 时生效 (`enable_analyzer = 1`，即默认值) ；旧 analyzer 在 26.7 之前同样会拒绝此类 key，因此无需恢复任何行为。显式 `GROUP BY` 不受影响，无论如何仍会拒绝此类 key，因此该设置的范围比 `allow_suspicious_types_in_group_by` 更窄，后者也允许在显式 `GROUP BY` 中使用它们。

可能的值：

* 0 - 不验证 `GROUP BY ALL` 展开后所得的 key types。
* 1 - 验证这些类型，与显式 `GROUP BY` 验证其自身 keys 的方式相同。

<h2 id="validate_mutation_query">
  validate\_mutation\_query
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.11"},{"label": "1"},{"label": "默认启用的新设置，用于验证变更查询。"}]}]} />

在接受变更查询之前先验证其有效性。变更操作在后台执行，运行无效查询可能导致变更操作卡住，并需要手动干预。

只有在遇到向后不兼容的 bug 时，才应更改此设置。

<h2 id="validate_polygons">
  validate\_polygons
</h2>

<SettingsInfoBlock type="Bool" default_value="1" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "20.4"},{"label": "1"},{"label": "默认情况下，如果 pointInPolygon 函数中的多边形无效，则抛出异常，而不是返回可能错误的结果"}]}]} />

如果多边形存在自相交或自相切，则启用或禁用 [pointInPolygon](/zh/reference/functions/regular-functions/geo/coordinates#pointinpolygon) 函数抛出异常。

可能的值：

* 0 — 禁用抛出异常。`pointInPolygon` 接受无效多边形，并可能返回不正确的结果。
* 1 — 启用抛出异常。
