> ## 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.

# ajustes de sesión de cast_*

> Ajustes de sesión de ClickHouse del grupo generado cast_*.

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
  }}>Tipo</div>
      <div style={{
    overflowWrap: "anywhere"
  }}>{type}</div>
      <div style={{
    fontWeight: 600,
    opacity: 0.72,
    marginInlineStart: "0.5rem"
  }}>Predeterminado</div>
      <div style={{
    overflowWrap: "anywhere"
  }}>{default_value}</div>
      {changeable_without_restart && <div style={{
    fontWeight: 600,
    opacity: 0.72,
    marginInlineStart: "0.5rem"
  }}>
          Modificable sin reiniciar
        </div>}
      {changeable_without_restart && <div style={{
    overflowWrap: "anywhere"
  }}>
          {changeable_without_restart}
        </div>}
    </div>;
};

Estas configuraciones están disponibles en [system.settings](/docs/es/reference/system-tables/settings) y se generan automáticamente a partir del [código fuente](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": "Hace que las funciones cast(value, 'IPv4') y cast(value, 'IPv6') se comporten igual que las funciones toIPv4 y toIPv6"}]}]} />

El operador CAST a IPv4, el operador CAST al tipo IPv6 y las funciones toIPv4 y toIPv6 devolverán el valor predeterminado en lugar de lanzar una excepción si se produce un error de conversión.

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

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

Habilita o deshabilita la conservación del tipo de dato `Nullable` en las operaciones [CAST](/docs/es/reference/functions/regular-functions/type-conversion-functions#CAST).

Cuando esta configuración está habilitada y el argumento de la función `CAST` es `Nullable`, el resultado también se convierte en el tipo `Nullable`. Cuando está deshabilitada, el resultado siempre tiene exactamente el tipo de destino.

Valores posibles:

* 0 — El resultado de `CAST` tiene exactamente el tipo de destino especificado.
* 1 — Si el tipo del argumento es `Nullable`, el resultado de `CAST` se convierte en `Nullable(DestinationDataType)`.

**Ejemplos**

La siguiente consulta devuelve exactamente el tipo de dato de destino:

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

Resultado:

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

La siguiente consulta aplica la modificación `Nullable` al tipo de datos de destino:

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

Resultado:

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

**Véase también**

* [CAST](/docs/es/reference/functions/regular-functions/type-conversion-functions#CAST) función
