All posts
Standard SQL Time Functions in ClickHouse® 26.3

Standard SQL Time Functions in ClickHouse® 26.3

July 23, 20265 min readSanjeev Kumar G
Share:

Standard SQL Time Functions in ClickHouse® 26.3 improve SQL compatibility by allowing developers to use familiar ANSI SQL syntax such as CURRENT_DATE, CURRENT_TIMESTAMP, and NOW without parentheses. This makes it easier to migrate queries from PostgreSQL, MySQL, SQL Server, and other relational databases.

Although this is a relatively small feature, it removes a common source of syntax incompatibility when moving existing SQL workloads to ClickHouse®.

What Changed?

Before version 26.3, obtaining the current date or timestamp typically required using ClickHouse® functions with parentheses:

SELECT today();
SELECT now();

Starting with ClickHouse® 26.3, several SQL-standard temporal functions can be written without parentheses, following the ANSI SQL specification.

Supported syntax includes:

SELECT CURRENT_DATE;
 
SELECT CURRENT_TIMESTAMP;
 
SELECT NOW;

This syntax is already familiar to users coming from many relational database systems.

Why This Matters

Many SQL databases implement temporal functions as SQL keywords rather than function calls. For example:

SELECT CURRENT_DATE;

instead of

SELECT today();

When migrating SQL applications, ORMs, BI dashboards, or reporting tools, these syntax differences often require query modifications. Supporting the standard syntax reduces the amount of migration work and improves portability.

Function Comparison

SQL StandardTraditional ClickHouse®26.3 Support
CURRENT_DATEtoday()Supported
CURRENT_TIMESTAMPnow()Supported
NOWnow()Supported without parentheses

These additions provide alternative syntax only-they do not replace the existing ClickHouse® functions.

Examples

Current Date

SELECT CURRENT_DATE;

Equivalent to:

SELECT today();

Example output:

2026-03-18

Current Timestamp

SELECT CURRENT_TIMESTAMP;

Equivalent to:

SELECT now();

Example output:

2026-03-18 14:35:12

NOW Without Parentheses

Previously:

SELECT now();

Now:

SELECT NOW;

Both return the same timestamp.

What Didn't Change

It is important to understand that this feature is primarily about SQL compatibility, not new date-time functionality.

ClickHouse® already provided functions such as:

  • today()
  • now()
  • toDate()
  • toDateTime()
  • dateDiff()
  • dateAdd()
  • toStartOfMonth()
  • toStartOfDay()

Version 26.3 does not replace these functions or introduce a new date-time engine. Instead, it allows developers to use SQL-standard syntax for obtaining the current date and timestamp.

Benefits for Migration

One of the main benefits of supporting SQL-standard time functions is reducing the effort required to migrate existing analytical workloads to ClickHouse®. Applications that were originally written for PostgreSQL, MySQL, or SQL Server often use ANSI SQL syntax for retrieving the current date or timestamp.

For example, a PostgreSQL query like:

SELECT CURRENT_DATE,
       CURRENT_TIMESTAMP;

can now be executed in ClickHouse® 26.3 without changing the temporal function syntax.

Similarly, applications that generate SQL dynamically through ORMs or reporting tools are less likely to require custom query transformations. While other SQL dialect differences may still exist, adopting SQL-standard temporal functions reduces one of the common syntax differences encountered during migration.

When Should You Use SQL-Standard Functions?

The introduction of SQL-standard syntax does not mean existing ClickHouse® functions should be replaced.

For new projects that prioritize SQL portability, using CURRENT_DATE and CURRENT_TIMESTAMP can make queries more familiar to developers with experience in other relational databases.

On the other hand, teams with an established ClickHouse® codebase may prefer to continue using native functions such as today() and now(). Both approaches are valid, and the choice largely depends on coding standards and migration requirements rather than performance.

Since these SQL-standard functions are simply alternative syntax, there is no functional advantage to rewriting existing queries solely to adopt them.

Compatibility Notes

The additions introduced in ClickHouse® 26.3 are focused on improving SQL compatibility rather than changing query execution semantics.

A few important points to remember:

Existing functions such as today() and now() continue to work without modification. SQL-standard functions provide equivalent results using ANSI-compliant syntax. Existing applications do not require any migration unless teams prefer to standardize on SQL syntax. This change primarily benefits users migrating workloads from other relational database systems or integrating third-party SQL tools.

By maintaining backward compatibility while adding standard SQL syntax, ClickHouse® allows developers to choose the style that best fits their environment without disrupting existing applications.

Although the change is small, adopting SQL-standard temporal syntax helps reduce migration friction, improves query portability, and makes ClickHouse® more approachable for teams with existing ANSI SQL experience.

Conclusion

The addition of SQL-standard time functions in ClickHouse® 26.3 is a compatibility improvement rather than a feature expansion. Existing ClickHouse® functions remain available and continue to work as before.

For organizations migrating analytical workloads from traditional relational databases, supporting syntax such as CURRENT_DATE, CURRENT_TIMESTAMP, and NOW without parentheses helps reduce query rewrites and improves interoperability with SQL-based tools and frameworks.

While the change is relatively small, it aligns ClickHouse® more closely with the ANSI SQL standard and contributes to a smoother migration experience for users adopting the platform.

References

clickhouse-change-log

Share: