Skip to content

sub_select is not properly parenthesized under some conditions #79

@tysonzero

Description

@tysonzero

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions