代码之家  ›  专栏  ›  技术社区  ›  geotheory

PostgreSQL错误函数width_bucket(带时区的时间戳,没有时区的时间戳记[])不存在

  •  0
  • geotheory  · 技术社区  · 4 年前

    已经解决了问题——在这里发帖,因为直到我翻译成中文,我才找到解决方案 blog post .

    ERROR:  function width_bucket(timestamp without time zone, timestamp with time zone[]) does not exist
    LINE 3:     width_bucket(
                ^
    HINT:  No function matches the given name and argument types. You might need to add explicit type casts.
    

    Error: Failed to prepare query: ERROR:  function width_bucket(timestamp with time zone, timestamp without time zone[]) does not exist
    LINE 3: width_bucket(
            ^
    HINT:  No function matches the given name and argument types. You might need to add explicit type casts.
    
    1 回复  |  直到 4 年前
        1
  •  0
  •   geotheory    4 年前

    解决方案是指定时区(即。 with time zone 下面)在您的串联发电机中:

    select generate_series(
           timestamp with time zone '2020-10-02 13:43:00', 
           '2020-10-17 16:15:00', 
           '12 hours'))
    

    ..或者确实如此 without time zone 这与您将要合并的数据与序列相匹配。使用 select pg_typeof(timecolumn) from table limit 1; 报告您的数据是否在概念上使用了时区。