From 634271fc81bf508e4a69c56d6ff0b3139ee19f45 Mon Sep 17 00:00:00 2001 From: Vladislav Syabruk Date: Wed, 26 Jun 2024 15:24:26 +0300 Subject: [PATCH] Fix creating views with subqueries --- .../connection_adapters/clickhouse/schema_creation.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/active_record/connection_adapters/clickhouse/schema_creation.rb b/lib/active_record/connection_adapters/clickhouse/schema_creation.rb index 95788792..428486e1 100644 --- a/lib/active_record/connection_adapters/clickhouse/schema_creation.rb +++ b/lib/active_record/connection_adapters/clickhouse/schema_creation.rb @@ -67,7 +67,7 @@ def assign_database_to_subquery!(subquery) # If you do not specify a database explicitly, ClickHouse will use the "default" database. return unless subquery - match = subquery.match(/(?<=from)[^.\w]+(?\w+(?=\.))?(?[.\w]+)/i) + match = subquery.match(/(?<=from)[^.\w(]+(?\w+(?=\.))?(?[.\w]+)/i) return unless match return if match[:database]