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

Issue with Empty Collection Query Results in LiteDB (GROUP BY) #87

Open
fernandozago opened this issue Jul 17, 2024 · 0 comments
Open

Comments

@fernandozago
Copy link

Issue with Empty Collection Query Results in LiteDB

Description

When executing queries on an empty collection (MyData with 0 rows) in LiteDB, the results are inconsistent and unexpected.
Specifically:

Query 1:

SELECT EXTEND(@KEY, {Total: Count(*)}) FROM MyData GROUP BY { Name };

Returns:

Total
1 0

Query 2:

SELECT @KEY AS Group, COUNT(*) as Total FROM MyData GROUP BY { Name };

Returns:

Group Total
1 (null) 0

Queries:

SELECT EXTEND(@KEY, {Total: 1}) FROM MyData GROUP BY { Name };

and

SELECT @KEY AS Group, 1 as Total FROM MyData GROUP BY { Name };

Returns:

[no result]

Expected Behavior

For an empty collection, these queries should consistently return no data. Specifically:
Queries executed on an empty collection (MyData with 0 rows) should return no rows, as there are no entries to group or extend.

Additional Information

The current behavior is inconsistent and may lead to incorrect assumptions about the presence of data in the collection. Ensuring that queries on empty collections return no data will align with typical SQL database behavior and improve predictability.

Is there any plan to improve the consistency of query results for empty collections in future LiteDB releases? Addressing this issue would greatly enhance the reliability and predictability of LiteDB for developers.

Thank you for your attention to this matter.

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

No branches or pull requests

1 participant