The README covers CTEs briefly, but doesn't mention how to handle explicit column lists should you need it. E.g. a CTE like:
WITH my_query (col1, col2, col3, col4) AS (
SELECT a, b, a, b FROM my_table
)
Is it possible to generate the above without a SqlLiteral? I used one in my solution, but every time I do it feels like I'm misbehaving. What's the right way?
Aside: this arose because of user-supplied queries with multiple columns of the same name b/c of joins. A query like this one:
select a.*, b.*
from a join b USING (my_id)
The above will have 2 columns named my_id. In this situation the CTE must specify the column list (with ambiguities corrected!) or the result is an ambiguous column name error (at least in PG).
Please use the mailing list or StackOverflow for questions/help, where a wider community will be able to help you. We reserve the issues tracker for issues only.
The README covers CTEs briefly, but doesn't mention how to handle explicit column lists should you need it. E.g. a CTE like:
Is it possible to generate the above without a SqlLiteral? I used one in my solution, but every time I do it feels like I'm misbehaving. What's the right way?
Aside: this arose because of user-supplied queries with multiple columns of the same name b/c of joins. A query like this one:
The above will have 2 columns named
my_id
. In this situation the CTE must specify the column list (with ambiguities corrected!) or the result is an ambiguous column name error (at least in PG).