Skip to content

with materialized cte #391

Answered by seancorfield
k3nj1g asked this question in Q&A
Discussion options

You must be logged in to vote

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:

dev=> (sql/format {:with [[:foo ^:materialized {:select :foo :from :bar}]]})
["WITH foo AS MATERIALIZED (SELECT fo…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by k3nj1g
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants