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

fix: prevent repetition of template IDs in template_usage_by_day #8693

Merged
merged 11 commits into from
Jul 24, 2023

Conversation

mtojek
Copy link
Member

@mtojek mtojek commented Jul 24, 2023

Fixes: #8690

Here is the dump from template_ids:

coder-# SELECT * FROM template_ids;
         from_          |                                     ids                                     
------------------------+-----------------------------------------------------------------------------
 2023-07-19 00:00:00+00 | {0d286645-29aa-4eaf-9b52-cc5d2740c90b}
 2023-07-20 00:00:00+00 | {071f39f5-d956-44b0-8849-7715059e2b2e,0d286645-29aa-4eaf-9b52-cc5d2740c90b}
 2023-07-20 00:00:00+00 | {0d286645-29aa-4eaf-9b52-cc5d2740c90b}
 2023-07-21 00:00:00+00 | {071f39f5-d956-44b0-8849-7715059e2b2e,0d286645-29aa-4eaf-9b52-cc5d2740c90b}
 2023-07-21 00:00:00+00 | {0d286645-29aa-4eaf-9b52-cc5d2740c90b}
 2023-07-22 00:00:00+00 | {0d286645-29aa-4eaf-9b52-cc5d2740c90b}
(6 rows)

We need to have distinct records for every day in from_, otherwise this part of the query fails with more than one row returned by a subquery used as an expression.

@mtojek mtojek self-assigned this Jul 24, 2023
@mtojek mtojek changed the title fix: template IDs can repeat in template_usage_by_day fix: prevent repetition of template IDs in template_usage_by_day Jul 24, 2023
@mtojek mtojek requested a review from johnstcn July 24, 2023 12:51
@mtojek mtojek marked this pull request as ready for review July 24, 2023 12:51
Copy link
Member

@johnstcn johnstcn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a difficult thing to test due our current daily aggregation setup. Approving to unblock.

@mtojek mtojek merged commit b7ced94 into main Jul 24, 2023
20 checks passed
@mtojek mtojek deleted the 8690-fix-internal-error branch July 24, 2023 13:07
@github-actions github-actions bot locked and limited conversation to collaborators Jul 24, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

bug: internal error on /api/v2/insights/templates
2 participants