【问题标题】:ERROR: invalid value for parameter "TimeZone": "Canada/East-Saskatchewan"错误:参数“TimeZone”的值无效:“Canada/East-Saskatchewan”
【发布时间】:2017-12-03 13:28:27
【问题描述】:

我正在导入一个使用 psql (PostgreSQL) 9.5.10 的数据库。对于我的本地数据库 v.9.6.5。

这是有问题的部分:

COPY timezone (id, name, windowsname, tzindex) FROM stdin;
...
315     Canada/East-Saskatchewan        \N      \N
...

这是我得到的错误:

pg_restore: [archiver (db)] Error while PROCESSING TOC: pg_restore: [archiver (db)] Error from TOC entry 9024; 0 48454 TABLE DATA timezone skysms pg_restore: [archiver (db)] COPY failed for table "timezone": ERROR: invalid value for parameter "TimeZone": "Canada/East-Saskatchewan" CONTEXT: SQL statement "SET local timezone to 'Canada/East-Saskatchewan'" PL/pgSQL function display_in_other_tz(timestamp with time zone,text,text) line 7 at EXECUTE statement COPY timezone, line 315: "315 Canada/East-Saskatchewan \N \N"

【问题讨论】:

  • 你在select * from pg_timezone_names where name like 'Canada%';之间看到了吗?..
  • 不,只有Canada/Saskatchewan
  • 至于FUNCTION pg_catalog.pg_timezone_names(OUT name text, OUT abbrev text, OUT utc_offset interval, OUT is_dst boolean),您需要接近 postgres 源的 smbd 帮助。我认为没有EastSaskatchewan 是一个错误......
  • 原服务器中存在。我不确定它是如何到达那里的(或者为什么它不在我的本地数据库中)。

标签: database postgresql timezone database-restore


【解决方案1】:

时区Canada/East-Saskatchewan 曾经是有效的时区标识符。这是America/Regina 时区的链接/别名。但是,在上一版本 (2017c) 中,它已从 tz 数据库中删除。你可以看到提交here

The 2017c release announcement 状态:

从 'backward' 文件中删除 Canada/East-Saskatchewan,因为它超过了 14 个字符的限制并且无论如何都是未使用的误称。

因此,虽然通常时区标识符不会以这种方式删除,但对于这个特定的时区标识符,由于其长度而被认为是必要的。

您可以安全地将Canada/East-Saskatchewan 的任何条目更新为区域的首选基于位置的形式:America/Regina

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2015-09-02
    • 1970-01-01
    • 2021-01-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多