Tuesday, 10 April 2012

Finding null records from date datatype column in postgres database


Hi,

While working with Postgres I had faced issue with query with date data type. When I try to fetch records with date column as null as below

subscriptions = Subscription.where(:retry_date => ' ' )

I have got the below error

PG::Error: ERROR: invalid input syntax for type date:

I came to see we cannot find the records through Active record as above.

By googling I found the way to fetch the records as below

subscriptions = Subscription.where(:retry_date => NIL )

Thank You,
Uma Mahesh.

No comments:

Post a Comment