generate_SQL缺少generate_series()函数

时间:2012-04-03 12:57:10

标签: java hibernate postgresql generate-series

我的申请遇到了一些问题。它适用于我的开发环境,但不适用于我的客户服务器..

带有时间戳的generate_series不起作用。相同的功能,但整数工作。

错误讯息:

 [Request processing failed; nested exception is javax.persistence.PersistenceException: org.hibernate.exception.SQLGrammarException: could not execute query] with root cause
    org.postgresql.util.PSQLException: ERROR: function generate_series(unknown, unknown, interval) does not exist
      Hint: No function matches the given name and argument types. You might need to add explicit type casts.

我找不到PostgreSQL中的函数。我在哪里可以获得这些方法的副本,以便我可以安装它们。

2 个答案:

答案 0 :(得分:2)

你没有提到你的PostgreSQL版本,但是

generate_series(timestamp, timestamp, interval)

在8.4之前无法使用

所以也许你使用的是过时的版本?

答案 1 :(得分:1)

您必须将timestamp值作为前两个函数参数传递。或者施展他们:

generate_series('2011-12-31'::timestamp, '2012-12-31'::timestamp, '1 day')
相关问题