Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Renaming Columns in CAggs causes issues when altering timescaledb.materialized_only #7800

Open
arfathyahiya opened this issue Mar 8, 2025 · 1 comment
Labels

Comments

@arfathyahiya
Copy link

What type of bug is this?

Other

What subsystems and features are affected?

Continuous aggregate

What happened?

I created the CAgg and then for better naming I changed a few column names. Since I did not name them properly at the time of creation and I noticed I was getting data only with 15 min delay
for example it's 10:15 now I was getting data only till 10:00 and rest of the data was not being materialized even tho refresh policy was set at 5 minute interval. To fix that I tried enabling real-time aggregation. On other tables it very much did work but for this one alone now I have to rename the columns back to original column names and set materialize_only=false and change them back again or I have to delete the CAgg and recreate them with proper settings which I don't want to do as it takes quite a lot of time for initial aggregation

TimescaleDB version affected

2.18.2

PostgreSQL version used

17.4

What operating system did you use?

Windows 10 x64

What installation method did you use?

Not applicable

What platform did you run on?

Timescale Cloud

Relevant log output and stack trace

SQL Error [42P17]: ERROR: SELECT rule's target entry 2 has different column name from column "timestamp"
  Detail: SELECT target entry is named "interval".

Error position:

How can we reproduce the bug?

CREATE MATERIALIZED VIEW activity_5min 
WITH (timescaledb.continuous) AS
SELECT
  avg(a."time_spent") as time_spent,
  time_bucket('5 minutes', a."timestampUTC") AS interval
FROM activity a
GROUP BY interval;

SELECT add_continuous_aggregate_policy('activity_5min',
  start_offset => INTERVAL '1 hour',
  end_offset => INTERVAL '5 minute',
  schedule_interval => INTERVAL '5 minute');


ALTER MATERIALIZED VIEW activity_5min RENAME COLUMN interval TO timestamp;

ALTER MATERIALIZED VIEW activity_5min SET (timescaledb.materialized_only=FALSE);
@BrandonSLockey
Copy link

agree with @arfathyahiya,timescale team important bug pls fix

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants