0

I'm having a problem with my Archives built on Ruby on Rails when I deploy to Heroku. Everything is working fine on my Local servers however when I run the app on Heroku there are problems when i load the page.

The Heroku logs showed this

PG::UndefinedFunction: ERROR:  function strftime(unknown, timestamp without time zone) does not exist
5
  • Is Heroku's Postgres using the same version as yours? Do you have all the same extensions enabled? Commented Feb 23, 2016 at 22:25
  • I just checked Heroku's Postgres is running an earlier version than mine. How would I check the other extensions installed? Commented Feb 23, 2016 at 22:51
  • I think it might be the version that's at fault, then. Can you please post the part of your code that uses strftime? It doesn't seem to be widely supported in Postgres, but it may be a very recent addition; and it might be an idea to see if you can refactor it on your end instead. Commented Feb 23, 2016 at 23:05
  • I use it in multiple places. But an example of that is like this. @bets_by_month = @bets_by_year.where("strftime('%m', created_at) = ?", params[:month]) Commented Feb 23, 2016 at 23:07
  • In that particular case, you may want to use .where("EXTRACT(MONTH FROM created_at) = ?", params[:month]). EXTRACT goes back at least as far as 9.0. See the Postgres docs. Or date_part is equivalent. Commented Feb 23, 2016 at 23:19

1 Answer 1

1

maybe you forgot to run migration on heroku. just do heroku run rake db:migrate

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.