Open wutuobangbang opened 1 year ago
hello @wutuobangbang thank you for reaching out. I'm a little confused by the use of 'timezone' in the issue title - I understand that the issue title should mention "offset" instead of "timezone" right? There is no version of integer time_bucket that supports time zone, if you want to use timezone, I would suggest using timestamps instead of integer time.
In the first case, you get this error message ERROR: continuous aggregate view must include a valid time bucket function
because even though the time_bucket function you’re using is a valid time_bucket function, in the context of cagg definition it is not supported, so not valid for use in cagg definition. We could show a clearer error message for this case.
In the second case you get this error message time bucket function must reference a hypertable dimension column
because you are using an expression referencing the ts column and not the ts column itself, and we do not allow an expression in the cagg defnition.
It looks like it would be easier for you to work with timestamps instead where it's possible to work with timezones in CAGG definitions.
I would also suggest reaching out to us in the community Slack and forum if you haven't already, as I think these are better platforms for discussing and getting help with a particular use-case, as this seems to be.
hello @wutuobangbang thank you for reaching out. I'm a little confused by the use of 'timezone' in the issue title - I understand that the issue title should mention "offset" instead of "timezone" right? There is no version of integer time_bucket that supports time zone, if you want to use timezone, I would suggest using timestamps instead of integer time.
In the first case, you get this error message
ERROR: continuous aggregate view must include a valid time bucket function
because even though the time_bucket function you’re using is a valid time_bucket function, in the context of cagg definition it is not supported, so not valid for use in cagg definition. We could show a clearer error message for this case. In the second case you get this error messagetime bucket function must reference a hypertable dimension column
because you are using an expression referencing the ts column and not the ts column itself, and we do not allow an expression in the cagg defnition. It looks like it would be easier for you to work with timestamps instead where it's possible to work with timezones in CAGG definitions. I would also suggest reaching out to us in the community Slack and forum if you haven't already, as I think these are better platforms for discussing and getting help with a particular use-case, as this seems to be.
thank you for your reply Forgive my English is not very good I want to aggregate sum by day. If I directly create continuous aggregation, the time is at 8:00 every day, but I want the time to be at 0:00 every day. I think this is a timezone raleted problem,i'm in shanghai; Or how can i set the offset to reduce 8 hour
Hello @wutuobangbang,
Thank you for getting back to us. As @konskov has pointed out, switching to the timestamptz
data type could solve the problem because then you could use the PostgreSQL functions for offsetting or timezone conversions. If this is not possible, you could try to adjust the timezone of your PostgreSQL session (e.g., SET TIME ZONE ...
). As you mentioned, you are in GMT+8 (China Standard Time), which might explain the 8-hour offset you see in the query results.
For further discussion of this use case, I recommend reaching out to our Community Slack. This is a good platform to discuss particular use cases.
What type of bug is this?
Unexpected error
What subsystems and features are affected?
Continuous aggregate
What happened?
I want to create a continuous aggregate summary_daily with integer-based time table ts_kv:
But the timezone is wrong, I want to set the timezone to 'Asia/Shanghai',and I do not know how;
This is What I have try, but i got error:
[0A000] ERROR: time bucket function must reference a hypertable dimension column
[XX000] ERROR: continuous aggregate view must include a valid time bucket function
How can I create continuous aggregate with integer-based time in another timezone? Thanks
TimescaleDB version affected
2.9.2
PostgreSQL version used
14.6
What operating system did you use?
Docker image timescale/timescaledb:latest-pg14 on Windows10 host
What installation method did you use?
Docker
What platform did you run on?
On prem/Self-hosted
Relevant log output and stack trace
How can we reproduce the bug?