v.22.7Improvement

Support auto_close option for PostgreSQL engine connection

Support auto_close option for PostgreSQL engine connection. Closes #31486. #38363 (Kseniia Sumarokova).
Added support for the auto_close option in the PostgreSQL database engine connection in ClickHouse.

Why it matters

This feature addresses connection management by automatically closing idle PostgreSQL engine connections, which helps to free up resources and improve stability when interacting with external PostgreSQL servers.

How to use it

When defining a PostgreSQL engine table, users can enable the auto_close option by adding it to the engine definition with a boolean value. For example:

CREATE TABLE example_table (
...
) ENGINE = PostgreSQL('host:port', 'database', 'table', 'user', 'password', auto_close=1);

Setting auto_close to 1 enables automatic closing of idle connections.