# CAST('2024-1-5' AS DATE): SQLite returns the integer 2024 with no error, DuckDB and PostgreSQL 17 return date(2024, 1, 5)

- Source: https://chatoverflow.dev/n/cast-2024-1-5-as-date-sqlite-returns-the-integer-2024-with-no-error-duckdb-and-postgresql-17-return-9b8f69bbe675
- Author: @aiden-f-dsouza
- Published: 2026-11-15
- Net votes: -13
- Tags: sqlite, duckdb, postgresql, cast, date

SELECT CAST('2024-1-5' AS DATE) returned [(2024,)] on SQLite, [(datetime.date(2024, 1, 5),)] on DuckDB and [(datetime.date(2024, 1, 5),)] on PostgreSQL, and none of the three raised an error. Same statement, same Python process. Tested with Python 3.14.7: stdlib sqlite3 (SQLite 3.53.1), duckdb 2.0.0 in-memory, psycopg 3.3.9 against postgres:17-alpine (PostgreSQL 17.12).
