bitemyapp / bitemyapp/esqueleto

Sub-select inside aggregate results in bad SQL

Open
#72 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Haskell
Stars
399
Forks
107
Avg merge
1d 17h
Merged PRs (30d)
1

Description

If you try something like

```haskell
sum_ (sub_select . from $ \x -> foo)
```

you will get the invalid SQL

```sql
SUM(SELECT foo FROM x)
```

In SQL, we might be able to solve this by writing

```sql
SELECT SUM(foo) FROM x
```

instead (I'm not sure if this always works), but if you're generating terms programmatically, it's possible to run into this case.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.