diff --git a/modules/saml/lib/SP/LogoutStore.php b/modules/saml/lib/SP/LogoutStore.php
index 8ef5aa21342d820d7bc7b5e5eb77536cec62f9b1..b9604916d6979dfb670c43ee9cf5bef70be178f9 100644
--- a/modules/saml/lib/SP/LogoutStore.php
+++ b/modules/saml/lib/SP/LogoutStore.php
@@ -108,14 +108,15 @@ class sspmod_saml_SP_LogoutStore {
 			'now' => gmdate('Y-m-d H:i:s'),
 		);
 
-		$query = 'SELECT _sessionIndex, _sessionId FROM ' . $store->prefix . '_saml_LogoutStore' .
+		/* We request the columns in lowercase in order to be compatible with PostgreSQL. */
+		$query = 'SELECT _sessionIndex AS _sessionindex, _sessionId AS _sessionid FROM ' . $store->prefix . '_saml_LogoutStore' .
 			' WHERE _authSource = :_authSource AND _nameId = :_nameId AND _expire >= :now';
 		$query = $store->pdo->prepare($query);
 		$query->execute($params);
 
 		$res = array();
 		while ( ($row = $query->fetch(PDO::FETCH_ASSOC)) !== FALSE) {
-			$res[$row['_sessionIndex']] = $row['_sessionId'];
+			$res[$row['_sessionindex']] = $row['_sessionid'];
 		}
 
 		return $res;