The "DB::Exception: Data type cannot have arguments" error appears when you supply parameters to a ClickHouse type that does not accept them. For example, writing String(255) or Int32(10), these types have no parameterization in ClickHouse, unlike some other databases where VARCHAR(255) or INT(10) are common.
Impact
The CREATE TABLE, ALTER, or CAST statement fails. This is a simple syntax issue that's quick to fix once you understand which ClickHouse types accept parameters and which don't.
Common Causes
- Porting schemas from MySQL/PostgreSQL: writing
String(255)(fromVARCHAR(255)),Int32(11)(fromINT(11)), orFloat64(10,2). - Adding unnecessary parentheses:
Date()orUUID()with empty parentheses where none are needed. - Confusing FixedString and String:
String(N)is not valid; useFixedString(N)for fixed-width strings. - Using the wrong Decimal syntax:
Decimal64requires one parameter (scale), not zero:Decimal64(4). - ORM or tool generating incorrect DDL: automated schema generators may add parameters to types that don't support them.
Troubleshooting and Resolution Steps
Remove the parameters from non-parametric types:
-- Wrong CREATE TABLE t (name String(255), age Int32(10)) ENGINE = MergeTree() ORDER BY tuple(); -- Correct CREATE TABLE t (name String, age Int32) ENGINE = MergeTree() ORDER BY tuple();Use FixedString(N) if you need a fixed-width string:
-- For fixed-width data like country codes CREATE TABLE t (country_code FixedString(2)) ENGINE = MergeTree() ORDER BY tuple();Check which types accept parameters. Here's a quick reference:
Accepts parameters Does not FixedString(N)StringDecimal(P, S)Int32,UInt64, etc.DateTime64(precision)Date,DateTimeEnum8(...),Enum16(...)Float32,Float64Array(T),Nullable(T)UUID,IPv4,IPv6Remove empty parentheses:
-- Wrong CREATE TABLE t (id UUID()) ENGINE = MergeTree() ORDER BY id; -- Correct CREATE TABLE t (id UUID) ENGINE = MergeTree() ORDER BY id;When migrating from MySQL, use this type mapping:
VARCHAR(N)/TEXT->StringCHAR(N)->FixedString(N)orStringINT(11)->Int32DOUBLE(10,2)->Float64orDecimal(10,2)
Best Practices
- When migrating schemas from other databases, strip type parameters that ClickHouse doesn't support rather than trying to translate them literally.
- Review the ClickHouse type documentation for each type's exact syntax before writing DDL.
- If using an ORM, verify it has a proper ClickHouse dialect that generates correct type syntax.
- Use
Stringinstead ofFixedStringunless you have a specific need for fixed-width storage.
Frequently Asked Questions
Q: Why doesn't ClickHouse String accept a length parameter like VARCHAR?
A: ClickHouse String is a variable-length type with no maximum length constraint. There is no need for a length parameter because ClickHouse handles string storage differently than row-oriented databases. If you need fixed-width storage, use FixedString(N).
Q: Can I enforce a maximum string length in ClickHouse?
A: Not through the type system. You can use a CHECK constraint or validate in your application layer. Alternatively, use FixedString(N) which enforces an exact byte width.
Q: What about DateTime, can I pass a timezone parameter?
A: Yes, DateTime('UTC') and DateTime64(3, 'UTC') are valid. The timezone is a valid parameter for DateTime types. The error occurs only when you add parameters to types that genuinely don't accept any.
Q: Does this error affect CAST expressions too?
A: Yes. CAST(x AS String(255)) will trigger the same error. Use CAST(x AS String) instead.