Answer an empty set-element result as NULL rather than raising - #355
Merged
estebanzimanyi merged 1 commit intoAug 29, 2026
Merged
Conversation
MEOS returns the empty set as a NULL pointer, so setMinus('{3}'::intset, 3),
setIntersection('{1}'::intset, 2) and their bigint, float, date, timestamptz
and text twins raise "Invalid Input Error: Null pointer not allowed" where the
answer is the empty set.
The generated body for a set with a scalar element marshals its result through
SetToBlobN, which carries a NULL pointer to SQL NULL. That is what PostgreSQL
answers: Setop_set_base in mobilitydb/src/temporal/set_ops.c, the shared
wrapper over intersection_set_value and minus_set_value, reads
"if (! result) PG_RETURN_NULL()". The (Set,Set) body beside it already answers
NULL for the same emptiness.
The registered surface is unchanged: duckdb_functions() reports the same 11625
rows, the emitted registration set is identical at 6065 lines, and the line
movement in the generated chunks is their split points shifting. setMinus of
{1,3,5} and 3 answers {1, 5}, setUnion of {1,3} and 9 answers {1, 3, 9}, and
setIntersection of {1,3} and 3 answers {3}.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
MEOS returns the empty set as a NULL pointer, so setMinus('{3}'::intset, 3),
setIntersection('{1}'::intset, 2) and their bigint, float, date, timestamptz
and text twins raise "Invalid Input Error: Null pointer not allowed" where the
answer is the empty set.
The generated body for a set with a scalar element marshals its result through
SetToBlobN, which carries a NULL pointer to SQL NULL. That is what PostgreSQL
answers: Setop_set_base in mobilitydb/src/temporal/set_ops.c, the shared
wrapper over intersection_set_value and minus_set_value, reads
"if (! result) PG_RETURN_NULL()". The (Set,Set) body beside it already answers
NULL for the same emptiness.
The registered surface is unchanged: duckdb_functions() reports the same 11625
rows, the emitted registration set is identical at 6065 lines, and the line
movement in the generated chunks is their split points shifting. setMinus of
{1,3,5} and 3 answers {1, 5}, setUnion of {1,3} and 9 answers {1, 3, 9}, and
setIntersection of {1,3} and 3 answers {3}.