Other functions

**Syntax**

```
generateSerialID(series_identifier[, start_value])
```

**Arguments**

- `series_identifier` — Series identifier [`const String`](/docs/sql-reference/data-types/string)
- `start_value` — Optional. Starting value for the counter. Defaults to 0. Note: this value is only used when creating a new series and is ignored if the series already exists [`UInt*`](/docs/sql-reference/data-types/int-uint)

**Returned value**

Returns sequential numbers starting from the previous counter value. [`UInt64`](/docs/sql-reference/data-types/int-uint)

**Examples**

**first call**

```
SELECT generateSerialID('id1')
```

```
┌─generateSerialID('id1')──┐
│                        1 │
└──────────────────────────┘
```

**second call**

```
SELECT generateSerialID('id1')
```

```
┌─generateSerialID('id1')──┐
│                        2 │
└──────────────────────────┘
```

**column call**

```
SELECT *, generateSerialID('id1') FROM test_table
```

```
┌─CounterID─┬─UserID─┬─ver─┬─generateSerialID('id1')──┐
│         1 │      3 │   3 │                        3 │
│         1 │      1 │   1 │                        4 │
│         1 │      2 │   2 │                        5 │
│         1 │      5 │   5 │                        6 │
│         1 │      4 │   4 │                        7 │
└───────────┴────────┴─────┴──────────────────────────┘
```

**with start value**

```
SELECT generateSerialID('id2', 100)
```

```
┌─generateSerialID('id2', 100)──┐
│                           100 │
└───────────────────────────────┘
```

**with start value second call**

```
SELECT generateSerialID('id2', 100)
```

```
┌─generateSerialID('id2', 100)──┐
│                           101 │
└───────────────────────────────┘
```

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

Introduced in: v24.5.0

Gets the value of an HTTP header.
If there is no such header or the current request is not performed via the HTTP interface, the function returns an empty string.
Certain HTTP headers (e.g., `Authentication` and `X-ClickHouse-*`) are restricted.

Note

Setting `allow_get_client_http_header` is required

The function requires the setting `allow_get_client_http_header` to be enabled.
The setting is not enabled by default for security reasons, because some headers, such as `Cookie`, could contain sensitive info.

HTTP headers are case sensitive for this function.
If the function is used in the context of a distributed query, it returns non-empty result only on the initiator node.

**Syntax**

```
getClientHTTPHeader(name)
```

**Arguments**

- `name` — The HTTP header name. [`String`](/docs/sql-reference/data-types/string)

**Returned value**

Returns the value of the header. [`String`](/docs/sql-reference/data-types/string)

**Examples**

**Usage example**

```
SELECT getClientHTTPHeader('Content-Type');
```

```
┌─getClientHTTPHeader('Content-Type')─┐
│ application/x-www-form-urlencoded   │
└─────────────────────────────────────┘
```

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

Introduced in: v20.1.0

Returns the value of a macro from the server configuration file.
Macros are defined in the [`<macros>`](/docs/operations/server-configuration-parameters/settings#macros) section of the configuration file and can be used to distinguish servers by convenient names even if they have complicated hostnames.
If the function is executed in the context of a distributed table, it generates a normal column with values relevant to each shard.

**Syntax**

```
getMacro(name)
```

**Arguments**

- `name` — The name of the macro to retrieve. [`const String`](/docs/sql-reference/data-types/string)

**Returned value**

Returns the value of the specified macro. [`String`](/docs/sql-reference/data-types/string)

**Examples**

**Basic usage**

```
SELECT getMacro('test');
```

```
┌─getMacro('test')─┐
│ Value            │
└──────────────────┘
```

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

Introduced in: v25.1.0

Returns the maximum table name length in a specified database.

**Syntax**

```
getMaxTableNameLengthForDatabase(database_name)
```

**Arguments**

- `database_name` — The name of the specified database. [`String`](/docs/sql-reference/data-types/string)

**Returned value**

Returns the length of the maximum table name, an Integer

**Examples**

**typical**

```
SELECT getMaxTableNameLengthForDatabase('default');
```

```
┌─getMaxTableNameLengthForDatabase('default')─┐
            │                                         206 │
            └─────────────────────────────────────────────┘
```

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

Introduced in: v25.6.0

Returns the current value of a MergeTree setting.

**Syntax**

```
getMergeTreeSetting(setting_name)
```

**Arguments**

- `setting_name` — The setting name. [`String`](/docs/sql-reference/data-types/string)

**Returned value**

Returns the merge tree setting's current value.

**Examples**

**Usage example**

```
SELECT getMergeTreeSetting('index_granularity');
```

```
┌─getMergeTreeSetting('index_granularity')─┐
│                                     8192 │
└──────────────────────────────────────────┘
```

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

Introduced in: v21.11.0

Returns a string with the OS kernel version.

**Syntax**

```
getOSKernelVersion()
```

**Arguments**

- None.

**Returned value**

Returns the current OS kernel version. [`String`](/docs/sql-reference/data-types/string)

**Examples**

**Usage example**

```
SELECT getOSKernelVersion();
```

```
┌─getOSKernelVersion()────┐
│ Linux 4.15.0-55-generic │
└─────────────────────────┘
```

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

Introduced in: v21.10.0

Returns the server's port number for a given protocol.

**Syntax**

```
getServerPort(port_name)
```

**Arguments**

- `port_name` — The name of the port. [`String`](/docs/sql-reference/data-types/string)

**Returned value**

Returns the server port number. [`UInt16`](/docs/sql-reference/data-types/int-uint)

**Examples**

**Usage example**

```
SELECT getServerPort('tcp_port');
```

```
┌─getServerPort('tcp_port')─┐
│                      9000 │
└───────────────────────────┘
```

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

Introduced in: v25.6.0

Returns the currently set value, given a server setting name.

**Syntax**

```
getServerSetting(setting_name')
```

**Arguments**

- `setting_name` — The server setting name. [`String`](/docs/sql-reference/data-types/string)

**Returned value**

Returns the server setting's current value. [`Any`](/docs/sql-reference/data-types)

**Examples**

**Usage example**

```
SELECT getServerSetting('allow_use_jemalloc_memory');
```

```
┌─getServerSetting('allow_use_jemalloc_memory')─┐
│ true                                          │
└───────────────────────────────────────────────┘
```

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

Introduced in: v20.7.0

Returns the current value of a setting.

**Syntax**

```
getSetting(setting_name)
```

**Arguments**

- `setting_Name` — The setting name. [`const String`](/docs/sql-reference/data-types/string)

**Returned value**

Returns the setting's current value. [`Any`](/docs/sql-reference/data-types)

**Examples**

**Usage example**

```
SELECT getSetting('enable_analyzer');
SET enable_analyzer = false;
SELECT getSetting('enable_analyzer');
```

```
┌─getSetting('⋯_analyzer')─┐
│ true                     │
└──────────────────────────┘
┌─getSetting('⋯_analyzer')─┐
│ false                    │
└──────────────────────────┘
```

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

Introduced in: v24.10.0

Returns the current value of a setting or returns the default value specified in the second argument if the setting is not set in the current profile.

**Syntax**

```
getSettingOrDefault(setting_name, default_value)
```

**Arguments**