[FIX] remove useless decodes that break on pg9.0

lp bug: https://launchpad.net/bugs/917030 fixed

bzr revid: al@openerp.com-20120208003800-whnxjgw2n2v0ea2i
This commit is contained in:
Antony Lesuisse 2012-02-08 01:38:00 +01:00
parent 66a3dc8ba7
commit 8289a2869e
1 changed files with 3 additions and 3 deletions

View File

@ -325,13 +325,13 @@ class db(netsvc.ExportService):
import pwd
db_user = pwd.getpwuid(os.getuid())[0]
if not db_user:
cr.execute("select decode(usename, 'escape') from pg_user where usesysid=(select datdba from pg_database where datname=%s)", (tools.config["db_name"],))
cr.execute("select usename from pg_user where usesysid=(select datdba from pg_database where datname=%s)", (tools.config["db_name"],))
res = cr.fetchone()
db_user = res and str(res[0])
if db_user:
cr.execute("select decode(datname, 'escape') from pg_database where datdba=(select usesysid from pg_user where usename=%s) and datname not in %s order by datname", (db_user, templates_list))
cr.execute("select datname from pg_database where datdba=(select usesysid from pg_user where usename=%s) and datname not in %s order by datname", (db_user, templates_list))
else:
cr.execute("select decode(datname, 'escape') from pg_database where datname not in %s order by datname", (templates_list,))
cr.execute("select datname from pg_database where datname not in %s order by datname", (templates_list,))
res = [str(name) for (name,) in cr.fetchall()]
except Exception:
res = []