代码之家  ›  专栏  ›  技术社区  ›  Eugen Konkov

`在postgres中将时区设置为'EEST'`会给我带来错误。为什么?

  •  0
  • Eugen Konkov  · 技术社区  · 6 年前

    在postgres中,我可以设置和读取时区:

    dev=> set timezone to 'UTC';
    SET
    dev=> select current_setting( 'timezone' );
     current_setting 
    -----------------
     UTC
    (1 row)
    

    EEST 时区:

    select exists( select 1 from pg_timezone_names where abbrev = 'EEST' );
     exists 
    --------
     t
    (1 row)
    

    为什么我不能设置它?

    dev=> set timezone to 'EEST';
    ERROR:  invalid value for parameter "TimeZone": "EEST"
    
    1 回复  |  直到 6 年前
        1
  •  0
  •   Eugen Konkov    6 年前

    感谢 <xocolatl> .

    pg_timezone_names EEST 名字,但有时区 UTC

    select * from pg_timezone_names where name = 'UTC';
     name | abbrev | utc_offset | is_dst 
    ------+--------+------------+--------
     UTC  | UTC    | 00:00:00   | f
    (1 row)