diff --git a/Database/Beam/Postgres/Connection.hs b/Database/Beam/Postgres/Connection.hs
--- a/Database/Beam/Postgres/Connection.hs
+++ b/Database/Beam/Postgres/Connection.hs
@@ -354,6 +354,9 @@
                 Nothing -> pure (Just x)
                 Just _ -> pure Nothing
 
+    runReturningFirst cmd =
+        liftF (PgRunReturning AtOnce cmd id id)
+
     runReturningList cmd =
         liftF (PgRunReturning AtOnce cmd consume id)
       where
diff --git a/Database/Beam/Postgres/Full.hs b/Database/Beam/Postgres/Full.hs
--- a/Database/Beam/Postgres/Full.hs
+++ b/Database/Beam/Postgres/Full.hs
@@ -260,6 +260,7 @@
 lateral_ using mkSubquery = do
   let Q subquery = mkSubquery (rewriteThread (Proxy @(QNested s)) using)
   Q (liftF (QArbitraryJoin subquery
+                           "lat_"
                            (\a b on' ->
                               case on' of
                                 Nothing ->
diff --git a/Database/Beam/Postgres/Syntax.hs b/Database/Beam/Postgres/Syntax.hs
--- a/Database/Beam/Postgres/Syntax.hs
+++ b/Database/Beam/Postgres/Syntax.hs
@@ -774,6 +774,8 @@
 
   inE e es = PgExpressionSyntax $ pgParens (fromPgExpression e) <> emit " IN " <>
                                   pgParens (pgSepBy (emit ", ") (map fromPgExpression es))
+  inSelectE e sel = PgExpressionSyntax $ pgParens (fromPgExpression e) <> emit " IN " <>
+                                         pgParens (fromPgSelect sel)
 
 instance IsSql99FunctionExpressionSyntax PgExpressionSyntax where
   functionCallE name args =
@@ -921,8 +923,8 @@
 
   -- According to the note at <https://www.postgresql.org/docs/9.2/static/functions-aggregate.html>
   -- the following functions are equivalent.
-  someE = pgUnAgg "BOOL_ANY"
-  anyE = pgUnAgg "BOOL_ANY"
+  someE = pgUnAgg "BOOL_OR"
+  anyE = pgUnAgg "BOOL_OR"
 
 instance IsSql92AggregationSetQuantifierSyntax PgAggregationSetQuantifierSyntax where
   setQuantifierDistinct = PgAggregationSetQuantifierSyntax $ emit "DISTINCT"
diff --git a/beam-postgres.cabal b/beam-postgres.cabal
--- a/beam-postgres.cabal
+++ b/beam-postgres.cabal
@@ -1,5 +1,5 @@
 name:                 beam-postgres
-version:              0.5.2.1
+version:              0.5.3.0
 synopsis:             Connection layer between beam and postgres
 description:          Beam driver for <https://www.postgresql.org/ PostgreSQL>, an advanced open-source RDBMS
 homepage:             https://haskell-beam.github.io/beam/user-guide/backends/beam-postgres
@@ -33,24 +33,24 @@
                       Database.Beam.Postgres.Types
 
   build-depends:      base                 >=4.9  && <5.0,
-                      beam-core            >=0.9  && <0.10,
+                      beam-core            >=0.10 && <0.11,
                       beam-migrate         >=0.5  && <0.6,
 
                       postgresql-libpq     >=0.8  && <0.10,
                       postgresql-simple    >=0.5  && <0.7,
 
-                      text                 >=1.0  && <1.3,
+                      text                 >=1.0  && <2.1,
                       bytestring           >=0.10 && <0.12,
 
                       attoparsec           >=0.13 && <0.15,
                       hashable             >=1.1  && <1.5,
                       lifted-base          >=0.2  && <0.3,
                       free                 >=4.12 && <5.2,
-                      time                 >=1.6  && <1.12,
+                      time                 >=1.6  && <1.13,
                       monad-control        >=1.0  && <1.1,
                       mtl                  >=2.1  && <2.3,
                       conduit              >=1.2  && <1.4,
-                      aeson                >=0.11 && <2.1,
+                      aeson                >=0.11 && <2.2,
                       uuid-types           >=1.0  && <1.1,
                       case-insensitive     >=1.2  && <1.3,
                       scientific           >=0.3  && <0.4,
diff --git a/test/Database/Beam/Postgres/Test/Select.hs b/test/Database/Beam/Postgres/Test/Select.hs
--- a/test/Database/Beam/Postgres/Test/Select.hs
+++ b/test/Database/Beam/Postgres/Test/Select.hs
@@ -43,6 +43,7 @@
       , testUuuidInValues getConn
       ]
   , testInRowValues getConn
+  , testInSelect getConn
   , testReturningMany getConn
   , testPgUnnest getConn
   ]
@@ -97,6 +98,14 @@
       let pair :: forall ctx s. Pair (QGenExpr ctx Postgres s)
           pair = val_ $ Pair False False
       return $ pair `in_` [pair, pair]
+    assertEqual "result" [True] result
+
+testInSelect :: IO ByteString -> TestTree
+testInSelect getConn = testCase "IN (SELECT ...) works" $
+  withTestPostgres "db_in_row_values" getConn $ \conn -> do
+    result <- runBeamPostgres conn $ runSelectReturningList $ select $ do
+      let x  = as_ @Int32 (val_ 1)
+      return $ x `inQuery_` ( pgUnnestArray $ array_ $ (as_ @Int32 . val_) <$> [0..100])
     assertEqual "result" [True] result
 
 testReturningMany :: IO ByteString -> TestTree
