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 Views loose type affinity w/ aggregates, workaround that #4

Open
helje5 opened this issue Aug 16, 2022 · 1 comment
Open

SQLite Views loose type affinity w/ aggregates, workaround that #4

helje5 opened this issue Aug 16, 2022 · 1 comment
Labels
bug Something isn't working

Comments

@helje5
Copy link
Member

helje5 commented Aug 16, 2022

As soon as an aggregate function is used, SQLite seems to loose the type affinity of the expression, e.g.:

CREATE TABLE fun ( value INT );
CREATE VIEW fun_sum AS SELECT SUM(value) AS combined FROM fun;

Results in:

/// Column `combined ` (`ANY`), optional (default: `nil`).
public var combined : String?

Which isn't great.

Adding CASTs doesn't seem to help with that, the affinity is lost by the aggregate function.
To fix that, we'd probably have to parse the SQL and follow the type-affinity in the expression AST. Possible but work.

@helje5 helje5 added the bug Something isn't working label Aug 16, 2022
@helje5
Copy link
Member Author

helje5 commented Aug 16, 2022

Related to issue #2

@helje5 helje5 changed the title SQLite looses type affinity when using aggregates, workaround that SQLite Views loose type affinity w/ aggregates, workaround that Aug 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant