Erik
1
Sorry about this noob question, but I haven’t found an answer after googling (a lot).
I am trying to use time_bucket on a hypertable, but I am unable to set bucket_width and timezone as specified in the tutorials. I get this error:
ERROR: invalid input syntax for type bigint: “1 week”
LINE 1: SELECT time_bucket(‘1 week’, ts, ‘Europe/Berlin’) AS min_buc…
^
Any help is greatly appreciated.
Hello @Erik - welcome to the forum!
It looks like you’re using a bigint
as the timestamp type. In this case, you’ll need to use the equivalent weekly representation as a bigint
as shown here in the docs: https://docs.timescale.com/api/latest/hyperfunctions/time_bucket/#required-arguments-for-integer-time-inputs
Assuming that your ts
column is milliseconds, I think this should be what you’re expecting.
SELECT time_bucket(604800000, ts, 'Europe/Berlin') AS min_bucket...
Adjust as necessary.
1 Like
Erik
3
Hello Ryan,
Thanks for your explanation, I appreciate it.
Best regards,
Erik
1 Like