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

Aggregate min on Bool column generates invalid query #14

Closed
ryskajakub opened this issue Dec 22, 2014 · 2 comments
Closed

Aggregate min on Bool column generates invalid query #14

ryskajakub opened this issue Dec 22, 2014 · 2 comments
Labels

Comments

@ryskajakub
Copy link
Contributor

Running Aggregate.min function on boolean column generates an invalid query that will fail when ran.

select id, min(closed) from
No function matches the given name and argument types. You might need to add explicit type casts.

Some other functions from the same module might have the same problem, like avg for string fields etc.


Idea: It could be solved by restricting the a type of min with a methodless typeclass. All the datatypes that can be applied to the function would be instances of the typeclass.

@tomjaguarpaw
Copy link
Owner

You are correct. This is currently a hole in Opaleye's "type system". You will notice there is a similar problem for the ordering operators, (>), (>=) etc.. Your suggested fix is sensible I think.

ryskajakub added a commit to ryskajakub/haskell-opaleye that referenced this issue May 5, 2015
That means, that the aggretation operators max() and min() can be ran on
columns of such type.
ryskajakub added a commit to ryskajakub/haskell-opaleye that referenced this issue May 5, 2015
@ryskajakub ryskajakub mentioned this issue May 5, 2015
Closed
ryskajakub added a commit to ryskajakub/haskell-opaleye that referenced this issue May 6, 2015
That means, that the aggretation operators max() and min() can be ran on
columns of such type.
ryskajakub added a commit to ryskajakub/haskell-opaleye that referenced this issue May 6, 2015
ryskajakub added a commit to ryskajakub/haskell-opaleye that referenced this issue May 6, 2015
@tomjaguarpaw
Copy link
Owner

be092f3

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

No branches or pull requests

2 participants