haskell-beam / haskell-beam/beam

Requesting `subselectWith_` combinator

Open
#662 4 comments 2 reactions 0 assignees View on GitHub
enhancement
Dominant language
Haskell
Stars
635
Forks
193
PR merge metrics
No merged PRs in 30d

Description

As far as I can tell, currently the only way to write recursive CTEs with `beam` is to use the `selectWith` combinator, which can only happen at the "top-level". However, (at least) Postgres supports recursive CTEs inside subqueries as well:

``` SQL
SELECT *
FROM (
WITH RECURSIVE my_cte AS (
SELECT 1
UNION ALL
SELECT 1 WHERE FALSE
)
SELECT *
FROM my_cte
) AS t;

?column?
----------
1
(1 row)
```

Would it be possible to write a `subselectWith_` primitive, analogous to `subquery_` and `selectWith_` that allows CTEs inside subselects like this (without even exposing the `With` wrapper outside the subselect)?

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.