From d92368f8e5a508715afdda3695eebd5029732978 Mon Sep 17 00:00:00 2001 From: Diego Augusto Molina Date: Tue, 22 Jan 2019 15:56:19 +0000 Subject: [PATCH] Use 'UPDATE pg_settings' for setting bytea_output as a convenience hack for those running on old, unsupported versions of PostgreSQL 'cos we're nice like that. --- web/pgadmin/utils/driver/psycopg2/connection.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/web/pgadmin/utils/driver/psycopg2/connection.py b/web/pgadmin/utils/driver/psycopg2/connection.py index 230b2a999..276927624 100644 --- a/web/pgadmin/utils/driver/psycopg2/connection.py +++ b/web/pgadmin/utils/driver/psycopg2/connection.py @@ -403,9 +403,13 @@ class Connection(BaseConnection): postgres_encoding, self.python_encoding = \ getEncoding(self.conn.encoding) + # Note that we use 'UPDATE pg_settings' for setting bytea_output as a + # convenience hack for those running on old, unsupported versions of + # PostgreSQL 'cos we're nice like that. status = _execute(cur, "SET DateStyle=ISO; " "SET client_min_messages=notice;" - "SET bytea_output=escape;" + "UPDATE pg_settings SET setting = 'escape'" + " WHERE name = 'bytea_output';" "SET client_encoding='{0}';" .format(postgres_encoding))