[pgAdmin4][RM#3289] Can't query SQL_ASCII database.

From: Aditya Toshniwal <aditya(dot)toshniwal(at)enterprisedb(dot)com>
To: pgadmin-hackers <pgadmin-hackers(at)postgresql(dot)org>
Subject: [pgAdmin4][RM#3289] Can't query SQL_ASCII database.
Date: 2018-05-22 06:05:32
Message-ID: CAM9w-_ntCUguZp2rVJXPsDvWJbWneAz4-AHJoYB+nUTSYMXc9g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgadmin-hackers

Hi Hackers,

PFA patch for RM#3289 where decode error was thrown on querying a SQL_ASCII
database table. Please note, this problem occurs only on windows.
Sample insert - insert into test_tab values ('é');

psycopg2 has a encodings dictionary where Postgres Database Encodings are
mapped to python equivalent. It uses 'ascii' decoder of python to decode
for SQL_ASCII encoding. If data has characters beyond the limit of ascii
then it failed. The solution would be to use utf_8 decoder instead of
ascii. I tried setting the client_encoding using
set_client_encoding('UTF8') method of a psycopg2 connection but no luck
(also its not allowed for async connection). I also tried executing "SET
CLIENT_ENCODING='UTF8'" but it didn't work too.
So, as in the patch, I had to set encodings dict value directly to 'utf_8'
and it seems to be working. Please note, the same is added to psycopg3
milestones
https://github.com/psycopg/psycopg2/milestone/4

Also fixed a small glitch for sql editor connection status check.

Kindly review.

Thanks and Regards,
Aditya Toshniwal
Software Engineer | EnterpriseDB Software Solutions | Pune
"Don't Complain about Heat, Plant a tree"

Attachment Content-Type Size
RM3289.patch application/octet-stream 1.1 KB

Responses

Browse pgadmin-hackers by date

  From Date Subject
Next Message Akshay Joshi 2018-05-22 06:07:51 Re: [pgAdmin4][Patch] Feature #3204 Notify/Listen not working in version 2.1
Previous Message Dave Page 2018-05-21 14:34:11 pgAdmin 4 commit: Need to CALL Yarn.