怎么解决PostgreSQL日期格式导致的错误
这篇文章主要讲解了“怎么解决PostgreSQL日期格式导致的错误”,文中的讲解内容简单清晰,易于学习与理解,下面请大家跟着小编的思路慢慢深入,一起来研究和学习“怎么解决PostgreSQL日期格式导致的错误”吧!
由于日期格式的不同,PostgreSQL在执行恢复读取recovery.conf的时候会出现问题.
错误信息
在recovery.conf文件,recovery_target_time的设置
recovery_target_time='2019-3-1114:40:00'
如按上述设置,则会出现错误
[xdb@localhosttestdb]$pg_ctlstartwaitingforservertostart....2019-03-1114:04:45.121CST[21749]LOG:listeningonIPv4address"0.0.0.0",port54322019-03-1114:04:45.121CST[21749]LOG:listeningonIPv6address"::",port54322019-03-1114:04:45.123CST[21749]LOG:listeningonUnixsocket"/tmp/.s.PGSQL.5432"2019-03-1114:04:45.135CST[21749]LOG:redirectinglogoutputtologgingcollectorprocess2019-03-1114:04:45.135CST[21749]HINT:Futurelogoutputwillappearindirectory"log".stoppedwaitingpg_ctl:couldnotstartserverExaminethelogoutput.
日志提示
[xdb@localhostlog]$catpostgresql-2019-03-11_122129.csv2019-03-1112:21:29.233CST,,,1680,,5c85e249.690,1,,2019-03-1112:21:29CST,,0,LOG,00000,"endinglogoutputtostderr",,"Futu2019-03-1112:21:29.236CST,,,1682,,5c85e249.692,1,,2019-03-1112:21:29CST,,0,LOG,00000,"databasesystemwasinterrupted;la2019-03-1112:21:29.249CST,,,1682,,5c85e249.692,2,,2019-03-1112:21:29CST,,0,FATAL,42601,"syntaxerrorinfile""recovery.c2019-03-1112:21:29.250CST,,,1680,,5c85e249.690,2,,2019-03-1112:21:29CST,,0,LOG,00000,"startupprocess(PID1682)exitedw2019-03-1112:21:29.250CST,,,1680,,5c85e249.690,3,,2019-03-1112:21:29CST,,0,LOG,00000,"abortingstartupduetostartuppro2019-03-1112:21:29.252CST,,,1680,,5c85e249.690,4,,2019-03-1112:21:29CST,,0,LOG,00000,"databasesystemisshutdown",,,,,,
在recovery.conf文件的第3行有语法错误,猜测是日期格式问题
日期格式
testdb=#showdatestyle;DateStyle-----------ISO,MDY(1row)
PG日期格式为月-日-年,recovery.conf文件的日期调整为该格式即可解决上述问题.
感谢各位的阅读,以上就是“怎么解决PostgreSQL日期格式导致的错误”的内容了,经过本文的学习后,相信大家对怎么解决PostgreSQL日期格式导致的错误这一问题有了更深刻的体会,具体使用情况还需要大家实践验证。这里是亿速云,小编将为大家推送更多相关知识点的文章,欢迎关注!
声明:本站所有文章资源内容,如无特殊说明或标注,均为采集网络资源。如若本站内容侵犯了原著者的合法权益,可联系本站删除。