> ## Documentation Index
> Fetch the complete documentation index at: https://clickhouse.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# cast_* 세션 설정

> cast_*로 생성된 그룹의 ClickHouse 세션 설정입니다.

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](/docs/ko/reference/system-tables/settings)에서 확인할 수 있으며, [소스](https://github.com/ClickHouse/ClickHouse/blob/master/src/Core/Settings.cpp)를 기반으로 자동 생성됩니다.

<div id="cast_ipv4_ipv6_default_on_conversion_error">
  ## cast\_ipv4\_ipv6\_default\_on\_conversion\_error
</div>

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

<VersionHistory rows={[{"id": "row-1","items": [{"label": "22.3"},{"label": "0"},{"label": "함수 cast(value, 'IPv4') 및 cast(value, 'IPv6')가 toIPv4 및 toIPv6 함수와 동일하게 동작하도록 변경"}]}]} />

IPv4로의 CAST 연산자, IPv6 유형으로의 CAST 연산자, toIPv4 및 toIPv6 함수는 변환 오류가 발생할 경우 예외를 발생시키는 대신 기본값을 반환합니다.

<div id="cast_keep_nullable">
  ## cast\_keep\_nullable
</div>

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

[CAST](/docs/ko/reference/functions/regular-functions/type-conversion-functions#CAST) 작업에서 `Nullable` 데이터 타입을 유지할지 여부를 설정합니다.

이 설정을 활성화하고 `CAST` 함수의 인수가 `Nullable`이면 결과도 `Nullable` 타입으로 변환됩니다. 이 설정을 비활성화하면 결과는 항상 지정된 대상 타입을 정확히 따릅니다.

Possible values:

* 0 — `CAST` 결과는 지정된 대상 타입을 정확히 따릅니다.
* 1 — 인수 타입이 `Nullable`이면 `CAST` 결과는 `Nullable(DestinationDataType)`으로 변환됩니다.

**예시**

다음 쿼리는 결과가 지정된 대상 데이터 타입이 되도록 합니다:

```sql theme={null}
SET cast_keep_nullable = 0;
SELECT CAST(toNullable(toInt32(0)) AS Int32) as x, toTypeName(x);
```

결과:

```text theme={null}
┌─x─┬─toTypeName(CAST(toNullable(toInt32(0)), 'Int32'))─┐
│ 0 │ Int32                                             │
└───┴───────────────────────────────────────────────────┘
```

다음 쿼리를 실행하면 대상 데이터 타입에 `Nullable` 수정자가 추가됩니다:

```sql theme={null}
SET cast_keep_nullable = 1;
SELECT CAST(toNullable(toInt32(0)) AS Int32) as x, toTypeName(x);
```

결과:

```text theme={null}
┌─x─┬─toTypeName(CAST(toNullable(toInt32(0)), 'Int32'))─┐
│ 0 │ Nullable(Int32)                                   │
└───┴───────────────────────────────────────────────────┘
```

**관련 항목**

* [CAST](/docs/ko/reference/functions/regular-functions/type-conversion-functions#CAST) 함수
