Postgres adapter appears to return nil dates for columns that actually have non-NULL values

Postgres 9.0.4
Rails 3.0.7
AR 3.0.7
pg 0.12.2

I have a table with 3 records in it with DATE column values of '0001-01-01 BC' (not sure how they got in there in the first place, there is no default value set on the column).

When I request these records and then query for this date column value through ActiveRelation, they return nil, but they are actually NOT NULL in the database.

See:

[3] pry(main)> User.where(birthday: '0001-01-01 BC').map {|u| u.birthday}
=> [nil, nil, nil]

Anyone seen anything like this or have any idea what's going on here?

Thanks, Wes

Answers


This looks like an issue that was fixed with this pull request. Updating rails should solve your problem.


Need Your Help

Why not image display as center in iOS7

ios iphone objective-c uiimageview

UIImageView doesn't display in center in iOS7 but it display correctly in StoryBoard design

Callback basics using Backbone.js

javascript node.js rest backbone.js

I'm using backbone to post a login form to my server. After it queries the database it will flip a boolean value allowing me to retrieve GET responses from the server. The problem is that it tries to