
dm-do-adapter + postgresql = "Couldn't parse date" error
Reported by Ravicious | October 10th, 2010 @ 10:13 AM
Hi,
I have a model:
class Replacement
include DataMapper::Resource
# code...
property :created_at, DateTime
# code...
def self.newest_unmailed
first(:sent => false, :order => [:created_at.desc])
end
# code...
end
My app uses PostgreSQL database (8.3.11) and the following gems:
- data_objects (0.10.2)
- dm-core (1.0.2)
- dm-do-adapter (1.0.2)
- dm-migrations (1.0.2)
- dm-postgres-adapter (1.0.2)
- dm-timestamps (1.0.2)
- dm-validations (1.0.2)
- do_postgres (0.10.2)
- pg (0.9.0)
When script executes Replacement.newest_unmailed
,
it crashes and gives me an output like this:
/home/rav/.rvm/gems/ruby-1.9.2-rc2/gems/dm-do-adapter-1.0.2/lib/dm-do-adapter/adapter.rb:145:in `next!': Couldn't parse date: 10.10.2010 14:35:08 (DataObjects::DataError)
from /home/rav/.rvm/gems/ruby-1.9.2-rc2/gems/dm-do-adapter-1.0.2/lib/dm-do-adapter/adapter.rb:145:in `block in read'
from /home/rav/.rvm/gems/ruby-1.9.2-rc2/gems/dm-do-adapter-1.0.2/lib/dm-do-adapter/adapter.rb:260:in `with_connection'
from /home/rav/.rvm/gems/ruby-1.9.2-rc2/gems/dm-do-adapter-1.0.2/lib/dm-do-adapter/adapter.rb:138:in `read'
from /home/rav/.rvm/gems/ruby-1.9.2-rc2/gems/dm-core-1.0.2/lib/dm-core/repository.rb:162:in `read'
from /home/rav/.rvm/gems/ruby-1.9.2-rc2/gems/dm-core-1.0.2/lib/dm-core/model.rb:379:in `first'
from /home/rav/webapps/schoolmailer/models/replacement.rb:18:in `newest_unmailed'
from scripts/sender.rb:31:in `<main>'
Switching to Ruby 1.9.2-p0 doesn't solve my problem. Any ideas?
Comments and changes to this ticket
-
Ravicious October 16th, 2010 @ 01:11 PM
I've figured out that dm-do-adapter can't parse any date when the datestyle in Postgresql's config is set to
SQL
. Postgresql's date/time output styles are in the documentation.
Please Sign in or create a free account to add a new ticket.
With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »