SIGN IN SIGN UP

Make the toYYYYMM documentation example independent of the current date

The example paired a query that reads the clock with a hardcoded expected output:

    SELECT toYYYYMM(now(), 'US/Eastern')   ->   202608

`tests/docs_examples/runner.py` compares the documented response to the server's
output verbatim, after nothing but `str.strip`, and an `output` mismatch with no
entry in `tests/docs_examples/known_failures.txt` is verdict `unexpected`, which
fails the job. `202608` was true only while the current month in `US/Eastern` was
August 2026, so the example broke the instant that timezone rolled into September
at 2026-09-01 04:00 UTC. It had entered the baseline as passing on 2026-08-02
because it was correct that day, which is why nothing caught it earlier: a latent
time bomb rather than flakiness. Bumping the literal to `202609` would only move
the failure to 2026-10-01.

The replacement uses the idiom the immediate siblings already use, a fixed
`toDateTime` literal. `toYYYYMMDD`, `toYYYYMMDDhhmmss`, `toYear`, `toMonth`,
`toQuarter` and `toDayOfMonth` are all written that way.

    SELECT toYYYYMM(toDateTime('2026-01-01 03:04:05', 'UTC'), 'US/Eastern')   ->   202512

That instant is `2025-12-31 22:04:05` in `US/Eastern`, so the timezone argument
moves the answer down a month and a year, which makes its effect visible; with
`now` the two spellings of the query agreed on all but one day a month. Both
timezones are pinned in the query, so the value does not depend on the server or
the session timezone either.

The generated pages under `docs/` carry the same stale value and are deliberately
untouched: they lie inside autogenerated regions, and
`ci/jobs/docs_autogen_nightly.py` regenerates them from this registration.

An `unstable` entry in `known_failures.txt` was rejected as the alternative. It
accepts any outcome, so it would permanently retire the check for this example
and leave the published page showing a value that is wrong for readers eleven
months out of twelve. That treatment is right for `today` and `yesterday`, whose
subject is the clock; here the clock is incidental to what the example teaches.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
G
Groene AI committed
26de122fdfaa3b79d7889f7d3f1dbfe1136e4a32
Parent: 9f35a2b