041.PGSQL-pgsql时间日期错误问题,原来是系统时间问题,我擦
作者:互联网
pgsql时间错误问题
mydb@[local]:5432=#select now();
now
-------------------------------
2021-07-05 08:07:22.981157+08
mydb@[local]:5432=# show time zone;
TimeZone
---------------
Asia/Shanghai
(1 row)
查看可供选择的时区
mydb@[local]:5432=#select * from pg_timezone_names; name | abbrev | utc_offset | is_dst ----------------------------------------+--------+------------+-------- Africa/Accra | GMT | 00:00:00 | f Africa/Algiers | CET | 01:00:00 | f Africa/Bissau | GMT | 00:00:00 | f Africa/Casablanca | WEST | 01:00:00 | t Africa/Ceuta | CEST | 02:00:00 | t Africa/El_Aaiun | WEST | 01:00:00 | t Africa/Monrovia | GMT | 00:00:00 | f Africa/Ndjamena | WAT | 01:00:00 | f Africa/Tunis | CET | 01:00:00 | f Africa/Windhoek | WAT | 01:00:00 | f Africa/Abidjan | GMT | 00:00:00 | f Africa/Bamako | GMT | 00:00:00 | f Africa/Banjul | GMT | 00:00:00 | f Africa/Conakry | GMT | 00:00:00 | f
中国公用时间 (PRC指:People's Republic of China)
mydb@[local]:5432=#select * from pg_timezone_names where name = 'PRC';
name | abbrev | utc_offset | is_dst
------+--------+------------+--------
PRC | CST | 08:00:00 | f
(1 row)
修改配置文件
[root@s101 /var/lib/pgsql/13/data]#nano postgresql.conf
log_timezone = 'PRC'
timezone = 'PRC'
重启数据库
[root@s101 /var/lib/pgsql/13/data]#sudo systemctl restart postgresql-13
再次查看还是没变
原来是系统时间错误
https://blog.csdn.net/weixin_43545225/article/details/106118354
再次查看
标签:PGSQL,00,01,PRC,Africa,pgsql,mydb,041,GMT 来源: https://www.cnblogs.com/star521/p/15072192.html