Merge pull request #3166 from matrix-org/dbkr/postgres_doesnt_have_ifnull

Use COALESCE rather than IFNULL
This commit is contained in:
David Baker 2018-05-01 18:15:28 +01:00 committed by GitHub
commit c06932a029
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -88,7 +88,7 @@ class ProfileWorkerStore(SQLBaseStore):
def f(txn): def f(txn):
sql = ( sql = (
"UPDATE profiles SET batch = " "UPDATE profiles SET batch = "
"(SELECT IFNULL(MAX(batch), -1) + 1 FROM profiles) " "(SELECT COALESCE(MAX(batch), -1) + 1 FROM profiles) "
"WHERE user_id in (" "WHERE user_id in ("
" SELECT user_id FROM profiles WHERE batch is NULL limit ?" " SELECT user_id FROM profiles WHERE batch is NULL limit ?"
")" ")"