generate_series() function missing PostgreSQL
-
28-05-2021 - |
题
I'm having some trouble with my application. It works in my development environment but not on my customers server..
The generate_series with timestamps does not work. The same function but with integers work.
Error message:
[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.
I can't locate the function in PostgreSQL. Where can I get a copy of these methods so I can install them if possible.
解决方案
You don't mention your PostgreSQL version, but
generate_series(timestamp, timestamp, interval)
was not available before 8.4
So maybe you are using an outdated version?
其他提示
You must pass timestamp
values as the first two function parameters. Or cast them:
generate_series('2011-12-31'::timestamp, '2012-12-31'::timestamp, '1 day')
不隶属于 StackOverflow