postgresqlclojurekormasqlkorma

Can Clojure Korma produce WITH - RETURNING query in Postgres?


I'm trying to reproduce this query from the Postgres docs:

WITH moved_rows AS (
    DELETE FROM products
    WHERE
        "date" >= '2010-10-01' AND
        "date" < '2010-11-01'
    RETURNING *
)
INSERT INTO products_log
SELECT * FROM moved_rows;

Can Korma actually do it (besides just writing raw SQL, of course)? I see no mention of it in the docs.

Thanks...


Solution

  • After diving into Korma source code, I've noticed that it generates queries by itself. Then I've grepped through the Korma source code and it has no RETURNING keyword in it:

    $ grep -ri returning .
    $
    

    So I came to a conclusion that unfortunately currently Korma doesn't support WITH-RETURNING Postgres' syntax.

    What you could do next is to contact Korma developers in their mailing list.