1

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...

2 Answers 2

1

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.

Sign up to request clarification or add additional context in comments.

Comments

0

I have successfully executed a similar query, an UPDATE with the RETURNING keyword, using the exec-raw function.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.