Skip to main content

String data type in Aiven for ClickHouse®

Aiven for ClickHouse® uses ClickHouse® databases, which can store diverse types of data, such as strings, decimals, booleans, or arrays.

About strings in ClickHouse

ClickHouse allows strings of any length. Strings can contain an arbitrary amount of bytes, which are stored and output as-is. The string type replaces the types VARCHAR, BLOB, CLOB, and others from other database management systems (DBMS). When creating tables, numeric parameters for string fields can be set (for example, TEXT(140)) but are ignored.

ClickHouse supports the following aliases for strings: LONGTEXT, MEDIUMTEXT, TINYTEXT, TEXT, LONGBLOB, MEDIUMBLOB, TINYBLOB, BLOB, VARCHAR, CHAR.

String-handling functions

String conversions

Any plain string type can be cast to a different type using functions in Type Conversion Functions.

Strings and JSON

ClickHouse supports a wide range of functions for working with JSON. With specific functions, you can use strings for extracting JSON.

Learn more on JSON functions in ClickHouse.

Examples
  • visitParamExtractString(params, name): Parse the string in double quotes.
  • JSONExtractString(json[, indices_or_keys]…): Parse a JSON and extract a string.
  • toJSONString: Convert a value of any data type to its JSON representation.