From 5af7410cb1485372c692625c178b32c64d4b392e Mon Sep 17 00:00:00 2001 From: Bernardo Damele Date: Fri, 11 Mar 2011 15:13:09 +0000 Subject: [PATCH] Another bug fix for --privileges on PgSQL with UNION query technique --- lib/core/agent.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/core/agent.py b/lib/core/agent.py index af681e0e0..2de24afa8 100644 --- a/lib/core/agent.py +++ b/lib/core/agent.py @@ -328,7 +328,7 @@ class Agent: if not Backend.getDbms(): return fields - if fields.startswith("(CASE") or fields.startswith("SUBSTR"): + if (fields.startswith("(CASE") and "WHEN use" in fields) or fields.startswith("SUBSTR"): nulledCastedConcatFields = fields else: fields = fields.replace(", ", ",") @@ -555,7 +555,7 @@ class Agent: inbandQuery += ", " if element == position: - if " FROM " in query and "(CASE " not in query and "EXISTS(" not in query and not query.startswith("SELECT "): + if " FROM " in query and ("(CASE " not in query or ("(CASE " in query and "WHEN use" in query)) and "EXISTS(" not in query and not query.startswith("SELECT "): conditionIndex = query.index(" FROM ") inbandQuery += query[:conditionIndex] else: @@ -563,7 +563,7 @@ class Agent: else: inbandQuery += char - if " FROM " in query and "(CASE" not in query and "EXISTS(" not in query and not query.startswith("SELECT "): + if " FROM " in query and ("(CASE " not in query or ("(CASE " in query and "WHEN use" in query)) and "EXISTS(" not in query and not query.startswith("SELECT "): conditionIndex = query.index(" FROM ") inbandQuery += query[conditionIndex:]