diff options
author | Lukas Fleischer <lfleischer@archlinux.org> | 2016-12-12 19:41:16 +0100 |
---|---|---|
committer | Lukas Fleischer <lfleischer@archlinux.org> | 2016-12-20 18:04:46 +0100 |
commit | fd36125a21ad6e4d665e1b2f4db784b073846d94 (patch) | |
tree | b7058f726351d93b5c58424255a8f4a5b94643ab /aurweb/scripts | |
parent | 9dd0d92d61462860089f479e0f0f6cd957a3ec04 (diff) | |
download | aur-fd36125a21ad6e4d665e1b2f4db784b073846d94.tar.gz aur-fd36125a21ad6e4d665e1b2f4db784b073846d94.tar.xz |
notify: Avoid EXCEPT in SQL statement
Do not use the EXCEPT clause which is unsupported in MySQL. Instead, use
a subquery which is standard-compliant and makes the query easier to
read at the same time.
Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
Diffstat (limited to 'aurweb/scripts')
-rwxr-xr-x | aurweb/scripts/notify.py | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/aurweb/scripts/notify.py b/aurweb/scripts/notify.py index 8fdfeb9a..69164fba 100755 --- a/aurweb/scripts/notify.py +++ b/aurweb/scripts/notify.py @@ -139,12 +139,10 @@ def get_request_recipients(conn, reqid): def get_tu_vote_reminder_recipients(conn, vote_id): - cur = conn.execute('SELECT Users.Email FROM Users ' + - 'WHERE AccountTypeID = 2 ' + - 'EXCEPT SELECT Users.Email FROM Users ' + - 'INNER JOIN TU_Votes ' + - 'ON TU_Votes.UserID = Users.ID ' + - 'WHERE TU_Votes.VoteID = ?', [vote_id]) + cur = conn.execute('SELECT Email FROM Users ' + + 'WHERE AccountTypeID = 2 AND ID NOT IN ' + + '(SELECT UserID FROM TU_Votes ' + + 'WHERE TU_Votes.VoteID = ?)', [vote_id]) return [row[0] for row in cur.fetchall()] |