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

AnyNumeric really wants impl std::iter::Sum #284

Closed
eeeebbbbrrrr opened this issue Apr 10, 2023 · 2 comments
Closed

AnyNumeric really wants impl std::iter::Sum #284

eeeebbbbrrrr opened this issue Apr 10, 2023 · 2 comments
Assignees
Labels
enhancement New feature or request

Comments

@eeeebbbbrrrr
Copy link
Contributor

eeeebbbbrrrr commented Apr 10, 2023

It would be nice if pgrx implemented impl std::iter::Sum -- would make AnyNumeric easier to use here in plrust land.

@eeeebbbbrrrr eeeebbbbrrrr self-assigned this Apr 10, 2023
@eeeebbbbrrrr eeeebbbbrrrr changed the title WIP: Inconveniences AnyNumeric really wants impl std::iter::Sum Apr 20, 2023
@eeeebbbbrrrr
Copy link
Contributor Author

well, would ya look at that: pgcentralfoundation/pgrx#1117

@eeeebbbbrrrr eeeebbbbrrrr added the enhancement New feature or request label Apr 20, 2023
@eeeebbbbrrrr
Copy link
Contributor Author

This got taken care of as part of #297

[v14.7][1841693] plrust=# create function sum_array(a numeric[]) returns numeric strict language plrust as $$ Ok(Some(a.into_iter().map(|e| e.unwrap()).sum()))
$$;
CREATE FUNCTION

[v14.7][1841693] plrust=# select sum_array(ARRAY[1, 2.0, 3.5]);
 sum_array 
-----------
       6.5
(1 row)

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

No branches or pull requests

1 participant