Other functions

## displayName[​](#displayName "Direct link to displayName")

Introduced in: v22.11.0

Returns the value of `display_name` from [config](/docs/operations/configuration-files) or the server's Fully Qualified Domain Name (FQDN) if not set.

**Syntax**

```
displayName()
```

**Arguments**

- None.

**Returned value**

Returns the value of `display_name` from config or server FQDN if not set. [`String`](/docs/sql-reference/data-types/string)

**Examples**

**Usage example**

```
SELECT displayName();
```

```
┌─displayName()─┐
│ production    │
└───────────────┘
```

## dumpColumnStructure[​](#dumpColumnStructure "Direct link to dumpColumnStructure")

Introduced in: v1.1.0

Outputs a detailed description of the internal structure of a column and its data type.

**Syntax**

```
dumpColumnStructure(x)
```

**Arguments**

- `x` — Value for which to get the description of. [`Any`](/docs/sql-reference/data-types)

**Returned value**

Returns a description of the column structure used for representing the value. [`String`](/docs/sql-reference/data-types/string)

**Examples**

**Usage example**

```
SELECT dumpColumnStructure(CAST('2018-01-01 01:02:03', 'DateTime'));
```

```
┌─dumpColumnStructure(CAST('2018-01-01 01:02:03', 'DateTime'))─┐
│ DateTime, Const(size = 1, UInt32(size = 1))                  │
└──────────────────────────────────────────────────────────────┘
```

## enabledProfiles[​](#enabledProfiles "Direct link to enabledProfiles")

Introduced in: v21.9.0

Returns an array of setting profile names which are enabled for the current user.

**Syntax**

```
enabledProfiles()
```

**Arguments**

- None.

**Returned value**

Returns an array of setting profile names which are enabled for the current user. [`Array(String)`](/docs/sql-reference/data-types/array)

**Examples**

**Usage example**

```
SELECT enabledProfiles();
```

```
┌─enabledProfiles()─────────────────────────────────────────────────┐
│ ['default', 'readonly_user', 'web_analytics', 'batch_processing'] │
└───────────────────────────────────────────────────────────────────┘
```

## enabledRoles[​](#enabledRoles "Direct link to enabledRoles")

Introduced in: v21.9.0

Returns an array of the roles which are enabled for the current user.

**Syntax**

```
enabledRoles()
```

**Arguments**

- None.

**Returned value**

Returns an array of role names which are enabled for the current user. [`Array(String)`](/docs/sql-reference/data-types/array)

**Examples**

**Usage example**

```
SELECT enabledRoles();
```

```
┌─enabledRoles()─────────────────────────────────────────────────┐
│ ['general_data', 'sql-console-role:[email protected]'] │
└────────────────────────────────────────────────────────────────┘
```

## errorCodeToName[​](#errorCodeToName "Direct link to errorCodeToName")

Introduced in: v20.12.0

Returns the textual name of a numeric ClickHouse error code.
The mapping from numeric error codes to error names is available [here](https://github.com/ClickHouse/ClickHouse/blob/master/src/Common/ErrorCodes.cpp).

**Syntax**

```
errorCodeToName(error_code)
```

**Arguments**

- `error_code` — ClickHouse error code. [`(U)Int*`](/docs/sql-reference/data-types/int-uint) or [`Float*`](/docs/sql-reference/data-types/float) or [`Decimal`](/docs/sql-reference/data-types/decimal)

**Returned value**

Returns the textual name of `error_code`. [`String`](/docs/sql-reference/data-types/string)

**Examples**

**Usage example**

```
SELECT errorCodeToName(252);
```

```
┌─errorCodeToName(252)─┐
│ TOO_MANY_PARTS       │
└──────────────────────┘
```

## file[​](#file "Direct link to file")

Introduced in: v21.3.0

Reads a file as a string and loads the data into the specified column.
The file content is not interpreted.

Also see the [`file`](/docs/sql-reference/table-functions/file) table function.

**Syntax**

```
file(path[, default])
```

**Arguments**

- `path` — The path of the file relative to the `user_files_path`. Supports wildcards `*`, `**`, `?`, `{abc,def}` and `{N..M}` where `N`, `M` are numbers and `'abc', 'def'` are strings. [`String`](/docs/sql-reference/data-types/string)
- `default` — The value returned if the file does not exist or cannot be accessed. [`String`](/docs/sql-reference/data-types/string) or [`NULL`](/docs/sql-reference/syntax#null)

**Returned value**

Returns the file content as a string. [`String`](/docs/sql-reference/data-types/string)

**Examples**

**Insert files into a table**

```
INSERT INTO table SELECT file('a.txt'), file('b.txt');
```

## filesystemAvailable[​](#filesystemAvailable "Direct link to filesystemAvailable")

Introduced in: v20.1.0

Returns the amount of free space in the filesystem hosting the database persistence.
The returned value is always smaller than the total free space ([`filesystemUnreserved`](/docs/sql-reference/functions/other-functions#filesystemUnreserved)) because some space is reserved for the operating system.

**Syntax**

```
filesystemAvailable([disk_name])
```

**Arguments**

- `disk_name` — Optional. The disk name to find the amount of free space for. If omitted, uses the default disk. [`String`](/docs/sql-reference/data-types/string) or [`FixedString`](/docs/sql-reference/data-types/fixedstring)

**Returned value**

Returns the amount of remaining space available in bytes. [`UInt64`](/docs/sql-reference/data-types/int-uint)

**Examples**

**Usage example**

```
SELECT formatReadableSize(filesystemAvailable()) AS "Available space";
```

```
┌─Available space─┐
│ 30.75 GiB       │
└─────────────────┘
```

## filesystemCapacity[​](#filesystemCapacity "Direct link to filesystemCapacity")

Introduced in: v20.1.0

Returns the capacity of the filesystem in bytes.
Needs the [path](/docs/operations/server-configuration-parameters/settings#path) to the data directory to be configured.

**Syntax**

```
filesystemCapacity([disk_name])
```

**Arguments**

- `disk_name` — Optional. The disk name to get the capacity for. If omitted, uses the default disk. [`String`](/docs/sql-reference/data-types/string) or [`FixedString`](/docs/sql-reference/data-types/fixedstring)

**Returned value**

Returns the capacity of the filesystem in bytes. [`UInt64`](/docs/sql-reference/data-types/int-uint)

**Examples**

**Usage example**

```
SELECT formatReadableSize(filesystemCapacity()) AS "Capacity";
```

```
┌─Capacity──┐
│ 39.32 GiB │
└───────────┘
```

## filesystemUnreserved[​](#filesystemUnreserved "Direct link to filesystemUnreserved")

Introduced in: v22.12.0

Returns the total amount of free space on the filesystem hosting the database persistence (previously `filesystemFree`).
See also [`filesystemAvailable`](#filesystemAvailable).

**Syntax**

```
filesystemUnreserved([disk_name])
```

**Arguments**

- `disk_name` — Optional. The disk name for which to find the total amount of free space. If omitted, uses the default disk. [`String`](/docs/sql-reference/data-types/string) or [`FixedString`](/docs/sql-reference/data-types/fixedstring)

**Returned value**

Returns the amount of free space in bytes. [`UInt64`](/docs/sql-reference/data-types/int-uint)

**Examples**

**Usage example**

```
SELECT formatReadableSize(filesystemUnreserved()) AS "Free space";
```

```
┌─Free space─┐
│ 32.39 GiB  │
└────────────┘
```

## finalizeAggregation[​](#finalizeAggregation "Direct link to finalizeAggregation")

Introduced in: v1.1.0

Given an aggregation state, this function returns the result of aggregation (or the finalized state when using a [-State](/docs/sql-reference/aggregate-functions/combinators#-state) combinator).

**Syntax**

```
finalizeAggregation(state)
```

**Arguments**

- `state` — State of aggregation. [`AggregateFunction`](/docs/sql-reference/data-types/aggregatefunction)

**Returned value**

Returns the finalized result of aggregation. [`Any`](/docs/sql-reference/data-types)

**Examples**

**Usage example**

```
SELECT finalizeAggregation(arrayReduce('maxState', [1, 2, 3]));
```

```
┌─finalizeAggregation(arrayReduce('maxState', [1, 2, 3]))─┐
│                                                       3 │
└─────────────────────────────────────────────────────────┘
```

**Combined with initializeAggregation**