bitemyapp / bitemyapp/esqueleto

sub_select is not properly parenthesized under some conditions

Open
#79 9 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

Specifically the following fails with `syntax error at or near "SELECT"`, because the inner sub_select is not properly enclosed in parenthesis.

```
aggrPrevDate :: MonadIO m => ReaderT SqlBackend m ()
aggrPrevDate = insertSelect . from $ \date -> do
groupBy $ date ^. DateDate
orderBy [asc $ date ^. DateDate]
pure $ PrevDate <# (date ^. DateDate) <&> sub_select (getPrevDate date)
where
getPrevDate date = from $ \d -> do
where_ $ d ^. DateDate <. date ^. DateDate
pure . max_ $ d ^. DateDate
```

This is with:

```
esqueleto 2.5.3
persistent 2.7.1
persistent-postgresql 2.6.2.1
```

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.