**Error:** function pg_catalog.extract(unknown, integer) does not exist HINT: No function matches the given name and argument types. **Problem:** In PostgreSQL, date - date returns INTEGER (days), not INTERVAL. EXTRACT(EPOCH FROM integer) fails because EPOCH expects timestamp/interval. **Solution:** Changed from: ORDER BY ABS(EXTRACT(EPOCH FROM (date - '2026-01-01'))) To: ORDER BY ABS(date - '2026-01-01'::date) This directly uses the day difference (integer) for sorting, which is exactly what we need to find the closest date. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>