summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/dialects/postgresql/base.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2013-05-26 16:39:50 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2013-05-26 16:39:50 -0400
commitb3654ee37abe7af3d83098cd8de1980369a3fcba (patch)
treec8b1543d9d4b872481988d0a3fa405509a2e6c0d /lib/sqlalchemy/dialects/postgresql/base.py
parentf939abe83034840b6c304df5ea4dfda5e9dc4633 (diff)
downloadsqlalchemy-b3654ee37abe7af3d83098cd8de1980369a3fcba.tar.gz
postgresql tests
Diffstat (limited to 'lib/sqlalchemy/dialects/postgresql/base.py')
-rw-r--r--lib/sqlalchemy/dialects/postgresql/base.py36
1 files changed, 16 insertions, 20 deletions
diff --git a/lib/sqlalchemy/dialects/postgresql/base.py b/lib/sqlalchemy/dialects/postgresql/base.py
index cd5d9772d..00d0acc2c 100644
--- a/lib/sqlalchemy/dialects/postgresql/base.py
+++ b/lib/sqlalchemy/dialects/postgresql/base.py
@@ -1569,14 +1569,13 @@ class PGDialect(default.DefaultDialect):
"""
rp = connection.execute(s)
# what about system tables?
-# start Py3K
- schema_names = [row[0] for row in rp \
+
+ if util.py2k:
+ schema_names = [row[0].decode(self.encoding) for row in rp \
+ if not row[0].startswith('pg_')]
+ else:
+ schema_names = [row[0] for row in rp \
if not row[0].startswith('pg_')]
-# end Py3K
-# start Py2K
-# schema_names = [row[0].decode(self.encoding) for row in rp \
-# if not row[0].startswith('pg_')]
-# end Py2K
return schema_names
@reflection.cache
@@ -1610,13 +1609,12 @@ class PGDialect(default.DefaultDialect):
AND '%(schema)s' = (select nspname from pg_namespace n
where n.oid = c.relnamespace)
""" % dict(schema=current_schema)
-# start Py3K
- view_names = [row[0] for row in connection.execute(s)]
-# end Py3K
-# start Py2K
-# view_names = [row[0].decode(self.encoding)
-# for row in connection.execute(s)]
-# end Py2K
+
+ if util.py2k:
+ view_names = [row[0].decode(self.encoding)
+ for row in connection.execute(s)]
+ else:
+ view_names = [row[0] for row in connection.execute(s)]
return view_names
@reflection.cache
@@ -1633,12 +1631,10 @@ class PGDialect(default.DefaultDialect):
rp = connection.execute(sql.text(s),
view_name=view_name, schema=current_schema)
if rp:
-# start Py3K
- view_def = rp.scalar()
-# end Py3K
-# start Py2K
-# view_def = rp.scalar().decode(self.encoding)
-# end Py2K
+ if util.py2k:
+ view_def = rp.scalar().decode(self.encoding)
+ else:
+ view_def = rp.scalar()
return view_def
@reflection.cache