Skip to content

Commit

Permalink
Fix discrepency in SQL query/export queries. Closes #1241.
Browse files Browse the repository at this point in the history
  • Loading branch information
knadh committed Mar 19, 2023
1 parent 35ddf3c commit aaf5080
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions queries.sql
Original file line number Diff line number Diff line change
Expand Up @@ -323,13 +323,13 @@ SELECT subscribers.id,
subscribers.created_at,
subscribers.updated_at
FROM subscribers
LEFT JOIN subscriber_lists sl
LEFT JOIN subscriber_lists
ON (
-- Optional list filtering.
(CASE WHEN CARDINALITY($1::INT[]) > 0 THEN true ELSE false END)
AND sl.subscriber_id = subscribers.id
AND subscriber_lists.subscriber_id = subscribers.id
)
WHERE sl.list_id = ALL($1::INT[]) AND id > $2
WHERE subscriber_lists.list_id = ALL($1::INT[]) AND id > $2
AND (CASE WHEN CARDINALITY($3::INT[]) > 0 THEN id=ANY($3) ELSE true END)
%query%
ORDER BY subscribers.id ASC LIMIT (CASE WHEN $4 < 1 THEN NULL ELSE $4 END);
Expand Down

0 comments on commit aaf5080

Please sign in to comment.