简体   繁体   中英

generate_series() function missing PostgreSQL

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')

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM