SELECT and INSERT queries) to exchange data between ClickHouse and PostgreSQL.
Gives the real-time access to table list and table structure from remote PostgreSQL with the help of SHOW TABLES and DESCRIBE TABLE queries.
Supports table structure modifications (ALTER TABLE ... ADD|DROP COLUMN). If use_table_cache parameter (see the Engine Parameters below) is set to 1, the table structure is cached and not checked for being modified, but can be updated with DETACH and ATTACH queries.
Creating a database
host:port— PostgreSQL server address.database— Remote database name.user— PostgreSQL user.password— User password.schema— PostgreSQL schema.use_table_cache— Defines if the database table structure is cached or not. Optional. Default value:0.
libpq and can be supplied through a named collection or as trailing key-value arguments: sslmode (disable, allow, prefer, require, verify-ca or verify-full), and the certificates and the key in one of two forms. sslrootcert (CA certificate), sslcert (client certificate) and sslkey (client private key) are paths to server-local files, accepted only from a named collection defined in the server configuration file. sslrootcert_pem, sslcert_pem and sslkey_pem accept the literal contents of the corresponding file instead, can be specified from SQL (for example, ENGINE = PostgreSQL('host:port', 'database', 'user', 'password', sslmode = 'verify-full', sslrootcert_pem = '...')), and are masked in logs and SHOW queries like a password. When unset, libpq defaults apply (sslmode=prefer).
Data types support
PostgreSQL
numeric(p, 0) with a precision p greater than 76 (the maximum supported by Decimal256) — for example numeric(78, 0), commonly used to store 256-bit integers — is mapped to Int256 instead of Decimal. Values that do not fit into the Int256 range are rejected with an error.Examples of use
Database in ClickHouse, exchanging data with the PostgreSQL server:use_table_cache parameter was set to 1 when the database was created, the table structure in ClickHouse was cached and therefore not modified: