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

Sqlite arithmetic on NULL should be nullable #1853

Closed
eygraber opened this issue Jul 21, 2020 · 0 comments · Fixed by #2256
Closed

Sqlite arithmetic on NULL should be nullable #1853

eygraber opened this issue Jul 21, 2020 · 0 comments · Fixed by #2256
Labels
Milestone

Comments

@eygraber
Copy link
Contributor

Runtime Environment
SQLDelight version: 1.3.0
Application OS: Android

If I perform an arithmetic operation on a non null column, that has an aggregate function applied to it, SqlDelight is expecting the result to be non null, when it could be nullable.

CREATE TABLE Test(
  id INTEGER PRIMARY KEY NOT NULL,
  timestamp INTEGER NOT NULL
);

SELECT MIN(timestamp) - 1 FROM Test WHERE id = <id that doesn't exist>;

min(X)
The min() aggregate function returns the minimum non-NULL value of all values in the group. The minimum value is the first non-NULL value that would appear in an ORDER BY of the column. Aggregate min() returns NULL if and only if there are no non-NULL values in the group.

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

Successfully merging a pull request may close this issue.

2 participants