-
Notifications
You must be signed in to change notification settings - Fork 5
Closed
Description
I have the following query:
sql = ~SQL"""
with subset as (
select distinct on (e.id) e.id as row_id
from "pacman.public".entities as e
join "pacman.public".transactions as t on t.entity_id = e.id
where e.status = 'done'
and t.strategy = 'unknown'
and t.sell_record_id is null
and t.buy_date < now() - interval '365 days'
)
update "pacman.public".entities
set status = 'stale'
from subset
where id = subset.row_id
"""
If I use to_sql
to see the generated sql, I get this result:
iex(pacman@node1.backend.core)6> sql |> to_sql
{"with update \"pacman.public\".entities set status = 'stale' from subset where id = subset.row_id", []}
Seems like SQL ignored the full with
expression
kafaichoi
Metadata
Metadata
Assignees
Labels
No labels