diff options
author | Irina Truong <i.chernyavska@gmail.com> | 2017-03-03 10:26:24 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-03-03 10:26:24 -0800 |
commit | b273d1375500a436ba09d80688f50766d51d6b6f (patch) | |
tree | 0b6bd50118a307bc17f8d068618571c31a6fcb4d | |
parent | 9cc58b7087eb31eb1ca142a0fe4cab7814b43437 (diff) | |
parent | 01f8f9f771cd09e2bfcc3a304e8c432c1b95b7da (diff) |
Merge pull request #647 from dbcli/amjith/fix-psycopg2-bug
Adjust the connection order to work around psycopg2 restriction.
-rw-r--r-- | pgcli/pgexecute.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/pgcli/pgexecute.py b/pgcli/pgexecute.py index 9c6167ef..650e7f5e 100644 --- a/pgcli/pgexecute.py +++ b/pgcli/pgexecute.py @@ -185,10 +185,6 @@ class PGExecute(object): cursor = conn.cursor() - cursor.execute("SHOW ALL") - db_parameters = dict(name_val_desc[:2] for name_val_desc in cursor.fetchall()) - - pid = self._select_one(cursor, 'select pg_backend_pid()')[0] conn.set_client_encoding('utf8') if hasattr(self, 'conn'): self.conn.close() @@ -199,6 +195,11 @@ class PGExecute(object): self.password = password self.host = host self.port = port + + cursor.execute("SHOW ALL") + db_parameters = dict(name_val_desc[:2] for name_val_desc in cursor.fetchall()) + + pid = self._select_one(cursor, 'select pg_backend_pid()')[0] self.pid = pid self.superuser = db_parameters.get('is_superuser') == '1' |