You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ClickHouse supports parameterized views, which allow view definitions to include placeholders such as {timezone:String} that are dynamically passed at query time. However, Flyway (via flyway-database-clickhouse) fails to preserve these placeholders — they are either stripped, misinterpreted as Flyway placeholders, or wrapped incorrectly — making it impossible to define parameterized views via Flyway migrations.
Create a view like this in a Flyway SQL migration file:
CREATE VIEW IF NOT EXISTS my_view
AS
SELECT
toDate(timestamp, {timezone:String}) AS day,
count() AS total
FROM my_table;
Run the migration via the Flyway Maven plugin.
Observe that:
[ERROR] SQL State : 07000
[ERROR] Error Code : 62
[ERROR] Message : Code: 62. DB::Exception: Syntax error: failed at position
This happens because Flyway interprets {timezone:String} as a Flyway placeholder and attempts to replace or remove it, resulting in invalid ClickHouse SQL.
Expected Behavior
The SQL should be passed to ClickHouse as-is, preserving {timezone:String} in the view definition so the view can be used like this:
SELECT * FROM my_view(timezone = 'UTC');
Request
Please consider adding support for preserving {param:Type} syntax as-is when passed to ClickHouse, or provide a mechanism to escape or disable Flyway's placeholder parsing in specific migrations.
This would allow us to use parameterized views — a native ClickHouse feature — directly within managed Flyway migrations.
The text was updated successfully, but these errors were encountered:
Summary
ClickHouse supports parameterized views, which allow view definitions to include placeholders such as {timezone:String} that are dynamically passed at query time. However, Flyway (via flyway-database-clickhouse) fails to preserve these placeholders — they are either stripped, misinterpreted as Flyway placeholders, or wrapped incorrectly — making it impossible to define parameterized views via Flyway migrations.
Environment
flyway-database-clickhouse version: 10.16.4
ClickHouse version: 24.12.1.18266
Flyway execution method: flyway-maven-plugin
Migration type: SQL
Steps to Reproduce
Create a view like this in a Flyway SQL migration file:
Run the migration via the Flyway Maven plugin.
Observe that:
This happens because Flyway interprets {timezone:String} as a Flyway placeholder and attempts to replace or remove it, resulting in invalid ClickHouse SQL.
Expected Behavior
The SQL should be passed to ClickHouse as-is, preserving {timezone:String} in the view definition so the view can be used like this:
SELECT * FROM my_view(timezone = 'UTC');
Request
Please consider adding support for preserving {param:Type} syntax as-is when passed to ClickHouse, or provide a mechanism to escape or disable Flyway's placeholder parsing in specific migrations.
This would allow us to use parameterized views — a native ClickHouse feature — directly within managed Flyway migrations.
The text was updated successfully, but these errors were encountered: