您好,登錄后才能下訂單哦!
這篇文章主要講解了“怎么解決PostgreSQL日期格式導(dǎo)致的錯(cuò)誤”,文中的講解內(nèi)容簡(jiǎn)單清晰,易于學(xué)習(xí)與理解,下面請(qǐng)大家跟著小編的思路慢慢深入,一起來(lái)研究和學(xué)習(xí)“怎么解決PostgreSQL日期格式導(dǎo)致的錯(cuò)誤”吧!
由于日期格式的不同,PostgreSQL在執(zhí)行恢復(fù)讀取recovery.conf的時(shí)候會(huì)出現(xiàn)問(wèn)題.
錯(cuò)誤信息
在recovery.conf文件,recovery_target_time的設(shè)置
recovery_target_time='2019-3-11 14:40:00'
如按上述設(shè)置,則會(huì)出現(xiàn)錯(cuò)誤
[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行有語(yǔ)法錯(cuò)誤,猜測(cè)是日期格式問(wèn)題
日期格式
testdb=# show datestyle; DateStyle ----------- ISO, MDY (1 row)
PG日期格式為月-日-年,recovery.conf文件的日期調(diào)整為該格式即可解決上述問(wèn)題.
感謝各位的閱讀,以上就是“怎么解決PostgreSQL日期格式導(dǎo)致的錯(cuò)誤”的內(nèi)容了,經(jīng)過(guò)本文的學(xué)習(xí)后,相信大家對(duì)怎么解決PostgreSQL日期格式導(dǎo)致的錯(cuò)誤這一問(wèn)題有了更深刻的體會(huì),具體使用情況還需要大家實(shí)踐驗(yàn)證。這里是億速云,小編將為大家推送更多相關(guān)知識(shí)點(diǎn)的文章,歡迎關(guān)注!
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。