with materialized cte #391
-
Can you help with register clause for materialized cte? For query like:
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
This is a tricky one because It would probably be easier all around if I just added support for this in core. This might be a good opportunity to add support for metadata directly into the formatter though, since the natural way to deal with SQL hints would be through metadata on the clauses I think: dev=> (sql/format {:with [[:foo ^:materialized {:select :foo :from :bar}]]})
["WITH foo AS MATERIALIZED (SELECT foo FROM bar)"] (although, in this case, that means the metadata support has to be in the |
Beta Was this translation helpful? Give feedback.
This is a tricky one because
MATERIALIZED
here is a hint on the CTE clause rather than a specific clause itself -- and CTE clauses are always wrapped in(
..)
so you would pretty much need a full:with-materialized
clause that duplicated most of what's already in the:with
formatter with just a slight change.It would probably be easier all around if I just added support for this in core.
This might be a good opportunity to add support for metadata directly into the formatter though, since the natural way to deal with SQL hints would be through metadata on the clauses I think: