Re: [pgAdmin4][patch] error message is incorrect in domains

From: Akshay Joshi <akshay(dot)joshi(at)enterprisedb(dot)com>
To: "zhangjie2(at)fujitsu(dot)com" <zhangjie2(at)fujitsu(dot)com>
Cc: "pgadmin-hackers(at)lists(dot)postgresql(dot)org" <pgadmin-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: [pgAdmin4][patch] error message is incorrect in domains
Date: 2021-09-27 10:23:23
Message-ID: CANxoLDfL_cAcbq5hdueK8qsarvjDtNq+tDdehaV3FUM8-93QtA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgadmin-hackers

Thanks, the patch applied.

On Mon, Sep 27, 2021 at 2:27 PM zhangjie2(at)fujitsu(dot)com <zhangjie2(at)fujitsu(dot)com>
wrote:

> Hi, all
>
> In domains's create function, res is used for all error messages.
> I don't think this is correct.
> On line 13, doid should be used as the error message.Because the execution
> result of line 11 is doid.
> On line 21, scid should be used as the error message.Because the execution
> result of line 19 is scid.
> There are similar problems in other functions.
> Here is a patch for domains.
> Please review.
>
> file:
> pgadmin4\web\pgadmin\browser\server_groups\servers\databases\schemas\domains\__init__.py
>
> ----------------------------------------------------------------------------
> def create(self, gid, sid, did, scid):
> ......
> 1 status, res = self.conn.execute_scalar(SQL)
> 2 if not status:
> 3 return internal_server_error(errormsg=res) ※1 res is OK
> 4
> 5 # We need oid to add object in tree at browser, below sql will
> 6 # gives the same
> 7 SQL = render_template("/".join([self.template_path,
> 8 self._OID_SQL]),
> 9 basensp=data['basensp'],
> 10 name=data['name'])
> 11 status, doid = self.conn.execute_scalar(SQL)
> 12 if not status:
> 13 return internal_server_error(errormsg=res) ※2 res => doid
> 14
> 15 # Get updated schema oid
> 16 SQL = render_template("/".join([self.template_path,
> 17 self._OID_SQL]),
> 18 doid=doid)
> 19 status, scid = self.conn.execute_scalar(SQL)
> 20 if not status:
> 21 return internal_server_error(errormsg=res) ※3 res => scid
>
> ----------------------------------------------------------------------------------
>

--
*Thanks & Regards*
*Akshay Joshi*
*pgAdmin Hacker | Principal Software Architect*
*EDB Postgres <http://edbpostgres.com>*

*Mobile: +91 976-788-8246*

In response to

Browse pgadmin-hackers by date

  From Date Subject
Next Message Akshay Joshi 2021-09-27 11:14:33 pgAdmin 4 commit: Port browser tree to React. Fixes #6129
Previous Message Akshay Joshi 2021-09-27 10:23:05 pgAdmin 4 commit: Correct the variable names in the error messages for