Fix SQL ORDER BY compatibility issue in Postgres 12/13.

- Fix for `pq: SELECT DISTINCT ON expressions must match
  initial ORDER BY expressions` in Postgres 13.
This commit is contained in:
Kailash Nadh 2020-11-08 16:02:11 +05:30
parent 1aecd6f2e1
commit 684c64ced1

View file

@ -537,7 +537,7 @@ subs AS (
WHERE subscriber_lists.status != 'unsubscribed' AND WHERE subscriber_lists.status != 'unsubscribed' AND
id > (SELECT last_subscriber_id FROM camps) AND id > (SELECT last_subscriber_id FROM camps) AND
id <= (SELECT max_subscriber_id FROM camps) id <= (SELECT max_subscriber_id FROM camps)
ORDER BY id LIMIT $2 ORDER BY subscribers.id LIMIT $2
), ),
u AS ( u AS (
UPDATE campaigns UPDATE campaigns