您好,登錄后才能下訂單哦!
這篇文章主要講解了“怎么解決PostgreSQL日期格式導致的錯誤”,文中的講解內容簡單清晰,易于學習與理解,下面請大家跟著小編的思路慢慢深入,一起來研究和學習“怎么解決PostgreSQL日期格式導致的錯誤”吧!
由于日期格式的不同,PostgreSQL在執行恢復讀取recovery.conf的時候會出現問題.
錯誤信息
在recovery.conf文件,recovery_target_time的設置
recovery_target_time='2019-3-11 14:40:00'
如按上述設置,則會出現錯誤
[xdb@localhost testdb]$ pg_ctl start waiting for server to start....2019-03-11 14:04:45.121 CST [21749] LOG: listening on IPv4 address "0.0.0.0", port 5432 2019-03-11 14:04:45.121 CST [21749] LOG: listening on IPv6 address "::", port 5432 2019-03-11 14:04:45.123 CST [21749] LOG: listening on Unix socket "/tmp/.s.PGSQL.5432" 2019-03-11 14:04:45.135 CST [21749] LOG: redirecting log output to logging collector process 2019-03-11 14:04:45.135 CST [21749] HINT: Future log output will appear in directory "log". stopped waiting pg_ctl: could not start server Examine the log output.
日志提示
[xdb@localhost log]$ cat postgresql-2019-03-11_122129.csv 2019-03-11 12:21:29.233 CST,,,1680,,5c85e249.690,1,,2019-03-11 12:21:29 CST,,0,LOG,00000,"ending log output to stderr",,"Futu 2019-03-11 12:21:29.236 CST,,,1682,,5c85e249.692,1,,2019-03-11 12:21:29 CST,,0,LOG,00000,"database system was interrupted; la 2019-03-11 12:21:29.249 CST,,,1682,,5c85e249.692,2,,2019-03-11 12:21:29 CST,,0,FATAL,42601,"syntax error in file ""recovery.c 2019-03-11 12:21:29.250 CST,,,1680,,5c85e249.690,2,,2019-03-11 12:21:29 CST,,0,LOG,00000,"startup process (PID 1682) exited w 2019-03-11 12:21:29.250 CST,,,1680,,5c85e249.690,3,,2019-03-11 12:21:29 CST,,0,LOG,00000,"aborting startup due to startup pro 2019-03-11 12:21:29.252 CST,,,1680,,5c85e249.690,4,,2019-03-11 12:21:29 CST,,0,LOG,00000,"database system is shut down",,,,,,
在recovery.conf文件的第3行有語法錯誤,猜測是日期格式問題
日期格式
testdb=# show datestyle; DateStyle ----------- ISO, MDY (1 row)
PG日期格式為月-日-年,recovery.conf文件的日期調整為該格式即可解決上述問題.
感謝各位的閱讀,以上就是“怎么解決PostgreSQL日期格式導致的錯誤”的內容了,經過本文的學習后,相信大家對怎么解決PostgreSQL日期格式導致的錯誤這一問題有了更深刻的體會,具體使用情況還需要大家實踐驗證。這里是億速云,小編將為大家推送更多相關知識點的文章,歡迎關注!
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。