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

klozovin
  • 2,363
  • 2
  • 22
  • 30

2 Answers2

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.

Aleksei Zyrianov
  • 2,294
  • 1
  • 24
  • 32
0

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

boechat107
  • 1,654
  • 14
  • 24