SQL error
invalid input syntax for type date: "March 1"
Updated · Tested on PostgreSQL 18.6 and SQLite 3.54.1 (results generated , re-checked on every release)
Short answer
PostgreSQL couldn't read the text as a date. Write dates as 'YYYY-MM-DD', such as '2026-03-15': that form works in every database, and in SQLite it also sorts correctly as text.
The exact messages
- PostgreSQLERROR: invalid input syntax for type date: "March 1"
- SQLiteNo error, but a silent surprise: see below.
How to read this message
This is what PostgreSQL 18.6 prints for the broken query below, the way psql shows it. LINE gives the line it was reading when it gave up, and the ^ marks the exact spot.
ERROR: invalid input syntax for type date: "March 1"
LINE 3: WHERE ordered_on > 'March 1';
^Why it happens
A date without a year, or in words
'March 1' or '1st March' isn't a full date. Use '2026-03-01'.
A day that doesn't exist
'2026-02-30' or month 13 gives a related message: date/time field value out of range.
An empty string from an import
'' isn't a date either. Turn blanks into NULL first: NULLIF(col, '')::date.
Reproduce it, then fix it
Both queries run on a real database in your browser. Switch dialects to compare.
SELECT id, ordered_on
FROM orders
WHERE ordered_on > 'March 1';SELECT id, ordered_on
FROM orders
WHERE ordered_on > '2026-03-15';ISO dates (YYYY-MM-DD) are read the same way by PostgreSQL and compare correctly as text in SQLite.
The fix returns, PostgreSQL: 4 rows
| id | ordered_on |
|---|---|
| 14 | 2026-03-18 |
| 15 | 2026-03-20 |
| 16 | 2026-03-22 |
| 17 | 2026-03-22 |
The fix returns, SQLite: 4 rows
| id | ordered_on |
|---|---|
| 14 | 2026-03-18 |
| 15 | 2026-03-20 |
| 16 | 2026-03-22 |
| 17 | 2026-03-22 |
Experiment with it: PostgreSQL playground·SQLite playground
Other forms of this mistake
Each one was run when this page was built; the result is what the engine really does.
SELECT id FROM orders WHERE ordered_on = '2026-02-30';PostgreSQLERROR: date/time field value out of range: "2026-02-30"
February has no 30th: a different message for the same mistake.
SELECT id FROM orders WHERE ordered_on = '';PostgreSQLERROR: invalid input syntax for type date: ""
An empty string fails the same way.
What SQLite does instead
SQLite stores dates as text and compares text with text, so ordered_on > 'March 1' compares letters with digits. It returns no rows and no error, which is worse: the query looks fine and is wrong.
Official documentation
Stop hitting this error
Practise the concept behind it in a five-minute lesson, or read the full guide: SQL date functions in PostgreSQL and SQLite.