Recently deployed a new webapp to Heroku. The app was prototyped using SQLite and am having difficulty with the database implementation in Heroku which uses postgresql. Namely, I am receiving this error and I am not sure how to troubleshoot:
2020-05-10T13:22:15.250905+00:00 app[web.1]: HINT: No operator matches the given name and argument types. You might need to add explicit type casts.
2020-05-10T13:22:15.250906+00:00 app[web.1]:
2020-05-10T13:22:15.250906+00:00 app[web.1]: [SQL: SELECT count(*) AS count_1
2020-05-10T13:22:15.250907+00:00 app[web.1]: FROM (SELECT favorites.fav_id AS favorites_fav_id, favorites.user_id AS favorites_user_id, favorites.post_id AS favorites_post_id, favorites.fav_date AS favorites_fav_date
2020-05-10T13:22:15.250907+00:00 app[web.1]: FROM favorites
2020-05-10T13:22:15.250907+00:00 app[web.1]: WHERE favorites.post_id = %(post_id_1)s) AS anon_1]
2020-05-10T13:22:15.250908+00:00 app[web.1]: [parameters: {'post_id_1': 1}]
2020-05-10T13:22:15.250908+00:00 app[web.1]: (Background on this error at: http://sqlalche.me/e/f405)
2020-05-10T13:22:15.255615+00:00 app[web.1]: 10.31.64.150 - - [10/May/2020:13:22:15 +0000] "GET /home HTTP/1.1" 500 290 "https://benchofthoughts.herokuapp.com/post/new" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.113 Safari/537.36"
2020-05-10T13:22:15.254572+00:00 heroku[router]: at=info method=GET path="/home" host=benchofthoughts.herokuapp.com request_id=1eed4376-3745-471d-8623-70217574197a fwd="47.20.85.233" dyno=web.1 connect=1ms service=31ms status=500 bytes=767 protocol=https
From reading this question and this question it looks like the query is trying to use a string
instead of an int
as the key to pull the relevant data, but this seemed to work fine using the prototype database. I am using SQLAlchemy for the queries so I assume the right variable types are implicitly being used, but I am not sure.
Can someone point me in the right direction to address this error?