Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fTkGb-0002ZN-Kh for pgadmin-hackers@arkaria.postgresql.org; Fri, 15 Jun 2018 08:39:33 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fTkGa-00023M-9s for pgadmin-hackers@arkaria.postgresql.org; Fri, 15 Jun 2018 08:39:32 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fTkFX-0005NS-RT for pgadmin-hackers@lists.postgresql.org; Fri, 15 Jun 2018 08:38:28 +0000 Received: from mail-wr0-x242.google.com ([2a00:1450:400c:c0c::242]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1fTkFU-0002uI-7A for pgadmin-hackers@postgresql.org; Fri, 15 Jun 2018 08:38:26 +0000 Received: by mail-wr0-x242.google.com with SMTP id d8-v6so9089481wro.4 for ; Fri, 15 Jun 2018 01:38:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pgadmin-org.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=7fTYy5j7TY8ckNoh8JXkAzGz0oWv0li3SrqSmt9fEIY=; b=EIoDtJTJ61L6j0bOq44kBrSEaNkab9WblSJ88nYxbOrj+3wwd/DMEbJjjW6AlgC3Tu Ijqs+G0HMJtjJUaf3znfWM0/GvRTr1Vl6K3n2178f3O4Se3+aazcfw2o0NKSypYns30V Il86dtCKfedkeqclWCWC++gNOaNRE3bBk5wrE6zySitkO1fumRj2n4PaZD9IDaV2q9gp hvWBI8tUdFrIdMPg4F81B0VAAJeqmu4tFKA51vf3bFVkyPeYMPymuU9TJJ6Yz8FsXilk chzaH6wuwPS02UYHyBHZnFyyxOByjIk/t8sp8QiMKnWp/cLALVcI4y61IB7fQ5nN9DIt 9HyA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=7fTYy5j7TY8ckNoh8JXkAzGz0oWv0li3SrqSmt9fEIY=; b=Pswv/RZAerq8ogEUUsbE6tN4DbW1e1lGAlXh7psnbhv7jhZJUql7KGFYUtbnJtuxZz Ik7zbIJ3rtIYJQQaDAhG0ERMAmekvW74qsoowMQXrnC2F7eBW7p8c+ZrP1p+CVYvRlpr hea/LJrByOdOYHwfdhDoIbfiNvQGfOQ3RgZz0fXRyaQlEQypOEqgzKIs+uOOpix/fjY4 wIMCIKBy86pqZ0DrbvQBv26+q/byfGFmP6y3SYUimXKSVqTe+4kdxYyxt4z2k+8lhuqK WEojKPZoEkQwBzwO40myH9UtzkyXV7KAwKJtwhfd0hYUZwZfsqV6NIg7YBAXbiA9WK7/ RIzg== X-Gm-Message-State: APt69E1pZFW7JY3qNpshQoyuO9WmLAxgnmA9ESHFaoUY48WazQ/llqnE vpKcoEmdvbnAOX8eiScec+RWOUVjGbFrbObr7ixeTw== X-Google-Smtp-Source: ADUXVKKsTVYG7O9SJtdTekpUxVLQBF3qe0CluNZdIxP7Wef3EcDPEfPyAPBEUjXmdL8k9c4HgtGhDfX+Kba5voS+s2E= X-Received: by 2002:adf:8211:: with SMTP id 17-v6mr773024wrb.144.1529051900906; Fri, 15 Jun 2018 01:38:20 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a1c:2907:0:0:0:0:0 with HTTP; Fri, 15 Jun 2018 01:38:19 -0700 (PDT) In-Reply-To: References: From: Dave Page Date: Fri, 15 Jun 2018 09:38:19 +0100 Message-ID: Subject: Re: [pgAdmin4][RM#3289] Can't query SQL_ASCII database. To: Aditya Toshniwal Cc: Joao De Almeida Pereira , pgadmin-hackers Content-Type: multipart/alternative; boundary="00000000000065a0b2056eaa238b" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --00000000000065a0b2056eaa238b Content-Type: text/plain; charset="UTF-8" Hi On Thu, Jun 14, 2018 at 7:05 AM, Aditya Toshniwal < aditya.toshniwal@enterprisedb.com> wrote: > I am sorry I missed the attachment. :( > PFA. > It looks like the encoding names are getting munged somewhere. I see you've accounted for that to some degree in connection.py (you have both SQL_ASCII/MULE_INTERNAL and SQLASCII/MULEINTERNAL), however it doesn't seem to be enough as I'm getting the following error when trying to download CSV from the query tool. Can we ensure that conn.encoding contains an un-munged value at all times, or is that coming from psycopg2? 2018-06-15 09:32:28,799: INFO werkzeug: 127.0.0.1 - - [15/Jun/2018 09:32:28] "GET /sqleditor/query_tool/download/2732923?query=SELECT%20*%20FROM%20public.sql_ascii%0AORDER%20BY%20id%20ASC%20&filename=sql_ascii.csv HTTP/1.1" 500 - 2018-06-15 09:32:28,801: ERROR werkzeug: Error on request: Traceback (most recent call last): File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/werkzeug/serving.py", line 270, in run_wsgi execute(self.server.app) File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/werkzeug/serving.py", line 260, in execute for data in application_iter: File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/werkzeug/wsgi.py", line 870, in __next__ return self._next() File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/werkzeug/wrappers.py", line 82, in _iter_encoded for item in iterable: File "/Users/dpage/git/pgadmin4/web/pgadmin/utils/driver/psycopg2/connection.py", line 752, in gen column_name = column_name.decode(conn_encoding) LookupError: unknown encoding: SQLASCII -- Dave Page Blog: http://pgsnake.blogspot.com Twitter: @pgsnake EnterpriseDB UK: http://www.enterprisedb.com The Enterprise PostgreSQL Company --00000000000065a0b2056eaa238b Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi

On Thu, Jun 14, 2018 at 7:05 AM, Aditya Toshniwal = <= aditya.toshniwal@enterprisedb.com> wrote:
I am sorry I missed the = attachment. :(
PFA.

It look= s like the encoding names are getting munged somewhere. I see you've ac= counted for that to some degree in connection.py (you have both SQL_ASCII/M= ULE_INTERNAL and SQLASCII/MULEINTERNAL), however it doesn't seem to be = enough as I'm getting the following error when trying to download CSV f= rom the query tool. Can we ensure that conn.encoding contains an un-munged = value at all times, or is that coming from psycopg2?

2018-06-15 09:32:28,799: INFO werkzeug: 127.0.0.1 - - [15/Jun/20= 18 09:32:28] "GET /sqleditor/query_tool/download/2732923?query=3DSELEC= T%20*%20FROM%20public.sql_ascii%0AORDER%20BY%20id%20ASC%20&filename=3Ds= ql_ascii.csv HTTP/1.1" 500 -
2018-06-15 09:32:28,801: ERROR<= span style=3D"white-space:pre"> werkzeug: Error on request:
Traceback (most recent call last):=
=C2=A0 File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2= .7/site-packages/werkzeug/serving.py", line 270, in run_wsgi
=C2=A0 =C2=A0 execute(self.server.app)
=C2=A0 File "/Users/= dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/werkzeug/serving.py= ", line 260, in execute
=C2=A0 =C2=A0 for data in applicatio= n_iter:
=C2=A0 File "/Users/dpage/.virtualenvs/pgadmin4/lib/= python2.7/site-packages/werkzeug/wsgi.py", line 870, in __next__
=
=C2=A0 =C2=A0 return self._next()
=C2=A0 File "/Users/d= page/.virtualenvs/pgadmin4/lib/python2.7/site-packages/werkzeug/wrappers.py= ", line 82, in _iter_encoded
=C2=A0 =C2=A0 for item in itera= ble:
=C2=A0 File "/Users/dpage/git/pgadmin4/web/pgadmin/util= s/driver/psycopg2/connection.py", line 752, in gen
=C2=A0 = =C2=A0 column_name =3D column_name.decode(conn_encoding)
LookupEr= ror: unknown encoding: SQLASCII

--
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @p= gsnake

EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL = Company
--00000000000065a0b2056eaa238b--