Postgres error with Sinatra/Haml/DataMapper on Heroku

Posted by sevennineteen on Stack Overflow See other posts from Stack Overflow or by sevennineteen
Published on 2010-05-29T17:31:56Z Indexed on 2010/05/31 7:32 UTC
Read the original article Hit count: 279

Filed under:
|
|
|

I'm trying to move a simple Sinatra app over to Heroku. Migration of the Ruby app code and existing MySQL database using Taps went smoothly, but I'm getting the following Postgres error:

PostgresError - ERROR: operator does not exist: text = integer LINE 1: ...d_at", "post_id" FROM "comments" WHERE ("post_id" IN (4, 17,... ^ HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts.

It's evident that the problem is related to a type mismatch in the query, but this is being issued from a Haml template by the DataMapper ORM at a very high level of abstraction, so I'm not sure how I'd go about controlling this...

Specifically, this seems to be throwing up on a call of p.comments from my Haml template, where p represents a given post.

The Datamapper models are related as follows:

class Post
    property :id, Serial
    ...
    has n, :comments
end

class Comment
    property :id, Serial
    ...
    belongs_to :post
end

This works fine on my local and current hosted environment using MySQL, but Postgres is clearly more strict.

There must be hundreds of Datamapper & Haml apps running on Postgres DBs, and this model relationship is super-conventional, so hopefully someone has seen (and determined how to fix) this. Thanks!

© Stack Overflow or respective owner

Related posts about postgresql

Related posts about heroku