v.21.8Improvement

Support Regex in Database Argument for StorageMerge

Support regular expression in Database argument for StorageMerge. Close #776. #25064 (flynn).
Add support for regular expressions in the Database argument of StorageMerge.

Why it matters

This feature allows users to specify a regular expression for the Database argument in the StorageMerge table engine, enabling dynamic merging of tables from multiple databases that match the regex pattern. It enhances flexibility and reduces the need to list databases explicitly.

How to use it

When creating or altering a StorageMerge table, provide a regular expression pattern in the Database argument instead of a fixed database name. For example:

CREATE TABLE merged_table AS Merge('^db_prefix.$', 'table_name', 'Merge')

This will merge all tables named table_name from databases whose names match the regex ^db_prefix.
$.