From 9ebf55ebc7d3a264b5b5ab7f2c820cbac5ac5ff6 Mon Sep 17 00:00:00 2001 From: Jordan Doyle Date: Fri, 09 Sep 2022 22:51:10 +0100 Subject: [PATCH] Fix CASE statements to use SQL standard syntax --- chartered-db/src/crates.rs | 2 +- chartered-db/src/organisations.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/chartered-db/src/crates.rs b/chartered-db/src/crates.rs index 8076c7a..b89a660 100644 --- a/chartered-db/src/crates.rs +++ a/chartered-db/src/crates.rs @@ -91,7 +91,7 @@ 0, )) .bitwise_or(diesel::dsl::sql::(&format!( - "COALESCE(CASE WHEN {} THEN {} OR 0 END, 0)", + "COALESCE(CASE WHEN {} THEN {} ELSE 0 END, 0)", "organisations.public", UserPermission::VISIBLE.bits(), ))) diff --git a/chartered-db/src/organisations.rs b/chartered-db/src/organisations.rs index b4495b8..728eb7e 100644 --- a/chartered-db/src/organisations.rs +++ a/chartered-db/src/organisations.rs @@ -20,7 +20,7 @@ 0, ) .bitwise_or(diesel::dsl::sql::(&format!( - "COALESCE(CASE WHEN {} THEN {} OR 0 END, 0)", + "COALESCE(CASE WHEN {} THEN {} ELSE 0 END, 0)", "public", UserPermission::VISIBLE.bits(), ))) -- rgit 0.1.3