v.20.11Improvement

Treat INTERVAL '1 hour' as equivalent to INTERVAL 1 HOUR for Postgres compatibility

Treat INTERVAL '1 hour' as equivalent to INTERVAL 1 HOUR, to be compatible with Postgres and similar. This fixes #15637. #15978 (flynn).
ClickHouse now treats INTERVAL '1 hour' as equivalent to INTERVAL 1 HOUR, improving compatibility with PostgreSQL and similar databases.

Why it matters

This feature addresses compatibility issues when using interval literals by allowing the string literal syntax for intervals, which is common in PostgreSQL. It ensures that queries using the INTERVAL 'value unit' format work seamlessly in ClickHouse, enhancing user experience for those migrating or interoperating between these systems.

How to use it

Users can write interval expressions using the PostgreSQL-style string syntax, for example:

SELECT now() + INTERVAL '1 hour';

This will be interpreted the same as:

SELECT now() + INTERVAL 1 HOUR;

No additional configuration is necessary to enable this behavior.