Thread: [pgAdmin4][Patch]: RM #3933 Error dropping database pop up messagedisplayed if user try to drop any database with Arabic character with nonsuper user
[pgAdmin4][Patch]: RM #3933 Error dropping database pop up messagedisplayed if user try to drop any database with Arabic character with nonsuper user
From
Akshay Joshi
Date:
Hi Hackers,
Attached is the patch to fix RM #3933 "Error dropping database pop up message displayed if user try to drop any database with Arabic character with non super user". There is an exception in the logging system for Arabic characters.
I have read https://docs.python.org/2/library/logging.html#logging.Handler.handleError and as part of fix set logging.raiseException = False
Please review it.
--

--
Akshay Joshi
Sr. Software Architect

Phone: +91 20-3058-9517
Mobile: +91 976-788-8246
Mobile: +91 976-788-8246
Attachment
Re: [pgAdmin4][Patch]: RM #3933 Error dropping database pop upmessage displayed if user try to drop any database with Arabic character withnon super user
From
Dave Page
Date:
Hi
On Wed, Feb 27, 2019 at 7:50 AM Akshay Joshi <akshay.joshi@enterprisedb.com> wrote:
Hi Hackers,Attached is the patch to fix RM #3933 "Error dropping database pop up message displayed if user try to drop any database with Arabic character with non super user". There is an exception in the logging system for Arabic characters.I have read https://docs.python.org/2/library/logging.html#logging.Handler.handleError and as part of fix set logging.raiseException = FalsePlease review it.
I'm fine with ignoring exceptions in the logger, but we should be able to log messages with UTF-8 characters in them surely? Is this just that we need to apply proper conversion to the error message, or does it occur in this case because the cluster was initialised in utf-8, but the maintenance DB is in some other encoding (which is a weird situation which can cause potential problems when working with global objects)?
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake
EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake
EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
Re: [pgAdmin4][Patch]: RM #3933 Error dropping database pop upmessage displayed if user try to drop any database with Arabic character withnon super user
From
Akshay Joshi
Date:
Hi Dave
On Wed, Feb 27, 2019 at 10:08 PM Dave Page <dpage@pgadmin.org> wrote:
HiOn Wed, Feb 27, 2019 at 7:50 AM Akshay Joshi <akshay.joshi@enterprisedb.com> wrote:Hi Hackers,Attached is the patch to fix RM #3933 "Error dropping database pop up message displayed if user try to drop any database with Arabic character with non super user". There is an exception in the logging system for Arabic characters.I have read https://docs.python.org/2/library/logging.html#logging.Handler.handleError and as part of fix set logging.raiseException = FalsePlease review it.I'm fine with ignoring exceptions in the logger, but we should be able to log messages with UTF-8 characters in them surely? Is this just that we need to apply proper conversion to the error message, or does it occur in this case because the cluster was initialised in utf-8, but the maintenance DB is in some other encoding (which is a weird situation which can cause potential problems when working with global objects)?
Yes, we log the UTF-8 characters in log file, as we set the file handler to utf-8 in the following line of code:
fh = logging.FileHandler(config.LOG_FILE, encoding='utf-8')
but with Arabic characters logger throws exception. Once we ignore the exception, message will be displayed on GUI properly. I have verified the encoding of both databases (Arabic one and maintenance DB) is same and it is "UTF-8". One more observation when I run this with source code bug is not reproducible, but when I run the installed version, it is reproducible.
--Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake
EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
Akshay Joshi
Sr. Software Architect

Phone: +91 20-3058-9517
Mobile: +91 976-788-8246
Mobile: +91 976-788-8246
Re: [pgAdmin4][Patch]: RM #3933 Error dropping database pop upmessage displayed if user try to drop any database with Arabic character withnon super user
From
Dave Page
Date:
OK, thanks. Applied.
On Thu, Feb 28, 2019 at 6:01 AM Akshay Joshi <akshay.joshi@enterprisedb.com> wrote:
Hi DaveOn Wed, Feb 27, 2019 at 10:08 PM Dave Page <dpage@pgadmin.org> wrote:HiOn Wed, Feb 27, 2019 at 7:50 AM Akshay Joshi <akshay.joshi@enterprisedb.com> wrote:Hi Hackers,Attached is the patch to fix RM #3933 "Error dropping database pop up message displayed if user try to drop any database with Arabic character with non super user". There is an exception in the logging system for Arabic characters.I have read https://docs.python.org/2/library/logging.html#logging.Handler.handleError and as part of fix set logging.raiseException = FalsePlease review it.I'm fine with ignoring exceptions in the logger, but we should be able to log messages with UTF-8 characters in them surely? Is this just that we need to apply proper conversion to the error message, or does it occur in this case because the cluster was initialised in utf-8, but the maintenance DB is in some other encoding (which is a weird situation which can cause potential problems when working with global objects)?Yes, we log the UTF-8 characters in log file, as we set the file handler to utf-8 in the following line of code:fh = logging.FileHandler(config.LOG_FILE, encoding='utf-8')but with Arabic characters logger throws exception. Once we ignore the exception, message will be displayed on GUI properly. I have verified the encoding of both databases (Arabic one and maintenance DB) is same and it is "UTF-8". One more observation when I run this with source code bug is not reproducible, but when I run the installed version, it is reproducible.--Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake
EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company--Akshay JoshiSr. Software ArchitectPhone: +91 20-3058-9517
Mobile: +91 976-788-8246
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake
EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake
EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company