postgresql Postgres 错误“参数“TimeZone”的值无效:“UTC””
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/11409075/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Postgres error "invalid value for parameter "TimeZone": "UTC""
提问by Stephen Nguyen
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!
尝试迁移到我的 postgres 数据库时,我不断收到此错误。帮助将不胜感激!
回答by MathiasJ
I had the same problem using the Postgres.app from Heroku. Rebooting my Mac solved it.
我在使用 Heroku 的 Postgres.app 时遇到了同样的问题。重新启动我的 Mac 解决了它。
回答by Michiel de Mare
Restarting postgresql works.
重新启动 postgresql 有效。
To restart if you've installed it using homebrew, brew info postgresql
will tell you to:
如果您使用自制软件安装了它,要重新启动,brew info postgresql
会告诉您:
launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
回答by Ricardo Ruwer
brew services restart postgresql
brew services restart postgresql
回答by Turadg
Try restarting the server. I updated Postgresql through Homebrew but forgot to restart the server and got this same problem. I believe it's due to the client and server versions not matching. psql started with:
尝试重新启动服务器。我通过 Homebrew 更新了 Postgresql,但忘记重新启动服务器并遇到了同样的问题。我相信这是由于客户端和服务器版本不匹配。psql 开始于:
$ psql
psql (9.1.4, server 9.1.2)
Type "help" for help.
回答by Flavio Wuensche
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.
我认为我不应该为此获得任何积分,但是重新启动我的 Postgres.app(这比重新启动整个系统更好)为我解决了这个问题。该应用程序没有显示在 Dock 上,您可以在窗口顶部的导航栏中找到它。希望它无论如何都有帮助。
回答by PJSCopeland
Based on @MathiasJ's answer, instead of rebooting my entire machine, I ran
根据@MathiasJ 的回答,我没有重新启动整个机器,而是跑了
brew services restart [email protected]
and my subsequent rake db:create
worked perfectly.
我的后续rake db:create
工作完美。
回答by fagiani
If nothing else fixes and you happen to be using homebrew
, chances are you have issues with current links.
如果没有其他解决方法并且您碰巧正在使用homebrew
,则您当前的链接可能有问题。
Assuming you have two Postgres
versions installed, make sure you unlink and then link again. In my case, I needed the two versions working in order to run pg_upgrade
. I have postgresql95
and postgresql
so I did:
假设您安装了两个Postgres
版本,请确保取消链接,然后再次链接。就我而言,我需要两个版本才能运行pg_upgrade
. 我有postgresql95
,postgresql
所以我做了:
$ brew unlink postgresql
$ brew unlink postgresql95
$ brew link postgresql95
$ brew link --overwrite postgresql
That got me both working at same time. Hope it becomes helpful as it took me a good while to figure that out!
这让我同时工作。希望它会有所帮助,因为我花了很长时间才弄明白!
回答by bcd
What actually happened is that you upgraded the postgresql server and cleaned-up your old folders but you haven't restarted your postgresql server. The server searched for the timezones files in the deleted dir
实际发生的情况是您升级了 postgresql 服务器并清理了旧文件夹,但您还没有重新启动 postgresql 服务器。服务器在删除的目录中搜索时区文件
回答by Paul Meier
I also had this problem.
我也有这个问题。
Login to the database then issue:
登录到数据库然后发出:
set time zone utc;
回答by dusan
In my case restarting the database didn't help. Updating tzdata (apt-get install tzdata
) did the trick for me.
在我的情况下,重新启动数据库没有帮助。更新 tzdata ( apt-get install tzdata
) 对我有用。