开发者

Getting error ERROR: date/time field value out of range: "31 APR 2001 in Postgres

开发者 https://www.devze.com 2023-03-09 00:09 出处:网络
I have a varchar field where dates are stored in the database where I need data from with values like 31 APR 2001 I run the following query

I have a varchar field where dates are stored in the database where I need data from with values like 31 APR 2001 I run the following query

select date(trim(contact_date)) from clients where date(trim(contact_date)) < '2002-03-12';

Whenever it hits 31 APR 2001 I get the error ERROR: date/time field value out of range: "31 APR 2001

Are there any workaround so that I won't get this error. Since all other dates get retur开发者_高级运维n perfectly.

The version of postgres I use is PostgreSQL 8.1.22


There are 30 days in the month of April.


there is no 31 in April month, prevent it from hitting 31 check it before query

0

精彩评论

暂无评论...
验证码 换一张
取 消