Write a self-contained example
Every run starts on an empty server, so put everything the query needs into one script: theCREATE TABLE, the INSERT and the SELECT.
version() in the result makes it obvious which version produced it. On the version this article was checked with, the script returns:
Compare two versions
Run the same script twice with different versions selected. For example, the range of theDate32 type was extended in ClickHouse 22.8 to start at the year 1900; before that it started at 1925 (see the 2022 changelog). This query shows the difference:
What the compatibility setting does and does not do
On a server that you already have, thecompatibility setting makes the server use the default values of settings from an older version. It does not turn the server into that version: functions, data types and bug fixes stay those of the binary that is running.
async_insert changed in 26.2, so compatibility = '25.12' brings the old default back. The toDate32 query above, however, returns 1912-06-15 with any value of compatibility.
To learn which defaults changed in which version, without running anything on the old version, query system.settings_changes: