metabase-clickhouse-driver
metabase-clickhouse-driver copied to clipboard
Substring Broken (1-based versus 0-based)
The substring function does not work as expected for custom fields.

In Metabase, the indices seem to be 0-based, whereas ClickHouse substring function expects indices to be 1-based:
Character indexing starts from one (as in standard SQL).
From clickhouse-server.err.log:
Indices in strings are 1-based: while executing 'FUNCTION substring(username :: 3, 0 :: 5, 10 :: 6) -> substring(username, 0, 10) String : 7'
Let‘s see what Metabase maintainers agree on in metabase/metabase#12445