Rails and Postgres aren't getting along after switching from Macports to Homebrew; PGError: ERROR: unrecognized time zone name: “UTC”

隐身守侯 提交于 2019-12-11 02:38:07

问题


I moved everything that I had in /opt/local (where Macports' things lived) into ~/.macports. That included my old postgres database cluster.

Then I installed postgres using Homebrew and ran the setup that it told me to (creating a new database cluster in /usr/local).

In my project, I ran rake db:drop:all and rake db:create. These did their work cheerfully.

But when I tried to rake db:migrate, postgres and rails fight and tell me

rake aborted!
PGError: ERROR:  unrecognized time zone name: "UTC"
: SET time zone 'UTC'

I don't know what they're talking about, though. I found this article about a config.time_zone bug slightly illuminating, but not enough to find my way.

Thanks!


回答1:


I was getting this error and simply need to start postgres manually:

  pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start

You can also stop it:

pg_ctl -D /usr/local/var/postgres stop -s -m fast



回答2:


After much head banging, I solved this problem by running:

env ARCHFLAGS="-arch x86_64" gem install pg




回答3:


I'm not completely sure how I fixed it, but uninstalling Postgres and reinstalling it (and following the setup instructions it gives very carefully) got it working.



来源:https://stackoverflow.com/questions/4154774/rails-and-postgres-arent-getting-along-after-switching-from-macports-to-homebre

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!