怎么解决PostgreSQL日期格式导致的错误
这篇文章主要讲解了“怎么解决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日期格式导致的错误这一问题有了更深刻的体会,具体使用情况还需要大家实践验证。这里是创新互联,小编将为大家推送更多相关知识点的文章,欢迎关注!
网站题目:怎么解决PostgreSQL日期格式导致的错误
网站链接:http://cdiso.cn/article/pcphjp.html