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

PG16 got stricter about Datum vs. Pointer #27

Merged
merged 3 commits into from
Sep 22, 2023
Merged

Conversation

df7cb
Copy link
Contributor

@df7cb df7cb commented Jul 30, 2023

Close #25.

@@ -2659,7 +2659,6 @@ tdigest_in(PG_FUNCTION_ARGS)
/* the centroids should be sorted by mean */
if (i > 0)
{
double mean = digest->centroids[i].mean;
Copy link
Collaborator

Choose a reason for hiding this comment

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

The declaration of mean on line 2662 shadowed the declaration from line 2642. Coincidentally at line 2648 we store mean in digest->centroids[i].mean so there is also no reason to read mean here again.

Not redeclaring mean here has a slight side effect where in certain situations the original mean has a different value after this branch. However, mean is not read anymore, and redeclared and initialized in the next iteration of the loop.

@thanodnl thanodnl merged commit 8ba27e0 into tvondra:master Sep 22, 2023
8 checks passed
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

Successfully merging this pull request may close these issues.

PostgreSQL 16 support
2 participants