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]: Timezone parameter to time_bucket_gapfill that is not a constant gives error #7629

Open
mkindahl opened this issue Jan 28, 2025 · 0 comments
Assignees

Comments

@mkindahl
Copy link
Contributor

What type of bug is this?

Unexpected error

What subsystems and features are affected?

Query executor

What happened?

Using time_bucket_gapfill with a non-constant timezone parameter gives an error. In this case, using coalesce.

TimescaleDB version affected

2.17.2

PostgreSQL version used

14.14, 17.2

What operating system did you use?

Ubuntu 24.04.1 LTS

What installation method did you use?

Source

What platform did you run on?

On prem/Self-hosted

Relevant log output and stack trace

ERROR:  attribute number 2 exceeds number of columns 1

How can we reproduce the bug?

create table property (
  property_id serial,
  timezone_label text
);

create table metrics (
    property_id int,
    time timestamptz
);

insert into property(timezone_label) values
       ('UTC'),
       (NULL),
       ('Europe/Stockholm'),
       ('WADT');

select count(*) as nprops from property \gset

insert into metrics(time, property_id)
select time, (:nprops * random())::int
from generate_series('2024-12-01T00:00:00Z'::timestamptz,
	             '2025-01-31T00:00:00Z'::timestamptz,
		     '10 minutes') time;

SELECT time_bucket_gapfill('1 day', time, timezone_label) AS day
  FROM metrics JOIN property USING (property_id)
 WHERE time > '2021-12-31 00:00:00+00'::timestamptz
   AND time < '2022-01-10 00:00:00-00'::timestamptz
GROUP BY day
ORDER BY day desc;
@mkindahl mkindahl added the bug label Jan 28, 2025
@mkindahl mkindahl self-assigned this Jan 28, 2025
@mkindahl mkindahl removed the bug label Jan 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant