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

Support extract(... from ...) #450

Merged
merged 2 commits into from
Sep 13, 2022
Merged

Support extract(... from ...) #450

merged 2 commits into from
Sep 13, 2022

Conversation

pdobacz
Copy link
Contributor

@pdobacz pdobacz commented Sep 12, 2022

... with a bonus bugfix

@pdobacz pdobacz force-pushed the piotr/extract-datetime branch 4 times, most recently from ae71b67 to f747e84 Compare September 12, 2022 11:48
@pdobacz pdobacz marked this pull request as ready for review September 12, 2022 11:56
if ((aggoid == g_oid_cache.sum_noise ||
aggoid == g_oid_cache.avg_noise) &&
TypeCategory(linitial_oid(aggref->aggargtypes)) == TYPCATEGORY_DATETIME)
FAILWITH_LOCATION(aggref->location, "Unsupported aggregate in query.");
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why are these aggregators allowed by type system while sum(timestamp) isn't? Can't we make the argument type identical with the original?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hm, I'm not sure I can explain this well, but I think this comes of the fact, that sum comes in many flavors, and sum(timestamp) isn't one. We track and rewrite all of these flavors to "our" anon_sum(any).

With _noise it is not rewritten but it is our own user-defined aggregate and it comes in one flavor diffix.sum_noise(any) from the "beginning". We could in theory define multiple flavors of dummy sum_noise and rewrite them to sum_noise_anon, to have the same semantics as sum. I don't remember anymore, why this path wasn't chosen (simplicity probably). I'm not sure if we have enough justification to do it now or if it's possible at all.

src/query/anonymization.c Outdated Show resolved Hide resolved
src/query/anonymization.c Show resolved Hide resolved
@pdobacz pdobacz merged commit 6711291 into master Sep 13, 2022
@pdobacz pdobacz deleted the piotr/extract-datetime branch September 13, 2022 07:28
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.

2 participants