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 aggregate functions #1325

Merged
merged 9 commits into from
Jun 21, 2024
Merged

Fix aggregate functions #1325

merged 9 commits into from
Jun 21, 2024

Conversation

trueqbit
Copy link
Collaborator

@trueqbit trueqbit commented Jun 20, 2024

Aggregate function objects must be created per aggregate context and not per result row.

Also, due to allocation errors, sqlite3_aggregate_context() may return a nullptr, and the standard allocator may trigger std::bad_alloc when creating the aggregate function object. This situation is translated into a SQLite query error.

Furthermore, the C++ data type of a pointer value in a function call is validated in addition to its SQLite pointer type (tag).

@trueqbit trueqbit linked an issue Jun 20, 2024 that may be closed by this pull request
@trueqbit trueqbit marked this pull request as ready for review June 21, 2024 17:04
@trueqbit trueqbit requested a review from fnc12 June 21, 2024 17:05
dev/function.h Outdated Show resolved Hide resolved
tests/user_defined_functions.cpp Outdated Show resolved Hide resolved
@trueqbit trueqbit merged commit 8f71f41 into dev Jun 21, 2024
2 of 3 checks passed
@trueqbit trueqbit deleted the fix-aggregate-functions branch June 21, 2024 21:50
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.

Aggregate function in example seems to work incorrectly
2 participants