From 684c64ced14742455b6f9da186d2fd07f5af6ce4 Mon Sep 17 00:00:00 2001 From: Kailash Nadh Date: Sun, 8 Nov 2020 16:02:11 +0530 Subject: [PATCH] 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. --- queries.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/queries.sql b/queries.sql index a602430..96b65b6 100644 --- a/queries.sql +++ b/queries.sql @@ -537,7 +537,7 @@ subs AS ( WHERE subscriber_lists.status != 'unsubscribed' AND id > (SELECT last_subscriber_id FROM camps) AND id <= (SELECT max_subscriber_id FROM camps) - ORDER BY id LIMIT $2 + ORDER BY subscribers.id LIMIT $2 ), u AS ( UPDATE campaigns