@@ -134,6 +134,8 @@ applyStaticRelationalOptimization e@(NotEquals _ _) = pure $ Right e
134134
135135applyStaticRelationalOptimization e@(Extend _ _) = pure $ Right e
136136
137+applyStaticRelationalOptimization e@(With _ _) = pure $ Right e
138+
137139applyStaticDatabaseOptimization :: DatabaseContextExpr -> DatabaseState (Either RelationalError DatabaseContextExpr)
138140applyStaticDatabaseOptimization x@NoOperation = pure $ Right x
139141applyStaticDatabaseOptimization x@(Define _ _) = pure $ Right x
@@ -378,6 +380,7 @@ applyStaticRestrictionCollapse expr =
378380 MakeStaticRelation _ _ -> expr
379381 ExistingRelation _ -> expr
380382 RelationVariable _ _ -> expr
383+ With _ _ -> expr
381384 Project attrs subexpr ->
382385 Project attrs (applyStaticRestrictionCollapse subexpr)
383386 Union sub1 sub2 ->
@@ -420,6 +423,7 @@ applyStaticRestrictionPushdown expr = case expr of
420423 MakeStaticRelation _ _ -> expr
421424 ExistingRelation _ -> expr
422425 RelationVariable _ _ -> expr
426+ With _ _ -> expr
423427 Project _ _ -> expr
424428 --this transformation cannot be inverted because the projection attributes might not exist in the inverted version
425429 Restrict restrictAttrs (Project projAttrs subexpr) ->
@@ -450,4 +454,4 @@ applyStaticRestrictionPushdown expr = case expr of
450454 Extend n sub ->
451455 Extend n (applyStaticRestrictionPushdown sub)
452456
453−
457+