Jupitor$ bundle exec rake db:create db:migrate
APP_development already exists
rake aborted!
PG::Error: ERROR: invalid value for parameter "TimeZone": "UTC"
: SET time zone 'UTC'
I keep getting this error when trying to migrate to my postgres database. help would be much appreciated!
I had a similar problem after updating time zone information, that is, downloading the IANA database and compiling using zic.
My problem actually began after restarting PostgreSQL. I got
invalid value for parameter TimeZone: UTC
and restarting again did nothing to solve the problem.It turns out my time zone information was completely messed up after the update. I had dangling symbolic links in
/usr/share/zoneinfo
. From a psql console, I got:I deleted all such dangling symlinks. After doing this, at least I could get
SELECT * FROM pg_timezone_names
to work, but still got the sameinvalid value...
error.What finally solved the problem for me was creating a new symlink:
After this,
SET time zone 'UTC'
worked correctly.Based on @MathiasJ's answer, instead of rebooting my entire machine, I ran
and my subsequent
rake db:create
worked perfectly.Just a quick reference for those that are not using Postgres.app, but that start psql from the command line or through launchctl. You'll need to adjust the following for where you have your Postgres data and log files located at:
I don't think I deserve any points for that but rebooting my Postgres.app (which is better than rebooting the whole system) solved it for me. The app doesn't show up on the Dock, you can find it on the navbar at the top of your window. Hope it helps anyway.
Restarting postgresql works.
To restart if you've installed it using homebrew,
brew info postgresql
will tell you to:In my case restarting the database didn't help. Updating tzdata (
apt-get install tzdata
) did the trick for me.