v.22.1Experimental Feature

Support TABLE OVERRIDE Clause for MaterializedPostgreSQL

Support TABLE OVERRIDE clause for MaterializedPostgreSQL. RFC: #31480. #32749 (Kseniia Sumarokova).
Support for TABLE OVERRIDE clause in MaterializedPostgreSQL engine.

Why it matters

This feature introduces the TABLE OVERRIDE clause for the MaterializedPostgreSQL engine, allowing users to specify custom table names to map the source PostgreSQL tables to target ClickHouse tables more flexibly. It solves the problem of rigid table naming mappings during replication, enabling better control over table synchronization and naming conventions.

How to use it

When creating or altering a MaterializedPostgreSQL table engine, use the TABLE OVERRIDE clause to explicitly specify the ClickHouse table name corresponding to a PostgreSQL source table. For example:

CREATE TABLE ch_table (
...
) ENGINE = MaterializedPostgreSQL(
'postgresql_host',
'database_name',
TABLE OVERRIDE 'source_table_name' = 'ch_table'
);