Re: [pgAdmin4][Patch]: Fix the logic to extract the error in Query tool

From: Murtuza Zabuawala <murtuza(dot)zabuawala(at)enterprisedb(dot)com>
To: Dave Page <dpage(at)pgadmin(dot)org>
Cc: pgadmin-hackers <pgadmin-hackers(at)postgresql(dot)org>
Subject: Re: [pgAdmin4][Patch]: Fix the logic to extract the error in Query tool
Date: 2017-09-19 07:55:09
Message-ID: CAKKotZTAxGEkMrsDO9mDTzbux1MagE8VDi5_4t+nXuHdXuNUrA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgadmin-hackers

Hi Dave,

Please find updated patch, I have tested following scenarios in query tool,
1) To test if we highlight faulty syntax
SQL: select a from pg_roles;

2) To check duplicates in error messages.
- Open query tool
- Uncheck Auto-Commit and run below sql 3 times and you will get an error
SQL: select a from pg_roles;

3) To check proper error
SQL: --insert into pg_roles values(1);

4) To check duplicates in error messages.
SQL: insert into pg_roles values(1);

5) Tested RAISE notices from function.

6) Tested JS testcases

Please review and let me know if I missed anything.

Regards,
Murtuza

On Mon, Sep 18, 2017 at 8:20 PM, Dave Page <dpage(at)pgadmin(dot)org> wrote:

> Hi
>
> On Mon, Sep 18, 2017 at 3:08 PM, Murtuza Zabuawala <
> murtuza(dot)zabuawala(at)enterprisedb(dot)com> wrote:
>
>> Hi Dave,
>>
>> Sorry my bad, I didn't check the backend code, I assumed that it is
>> coming from psycopg2 and so I was focusing it to remove from client side :(
>>
>> PFA updated patch.
>>
>
> I think it needs to be a bit smarter than that. Whilst it works well for
> the "empty query" message, it doesn't work well for errors that have full
> details. For instance, instead of:
>
> ========================================================
> ERROR: relation "pg_foo" does not exist
> LINE 1: select * from pg_foo
> ^
> ********** Error **********
>
> ERROR: relation "pg_foo" does not exist
> SQL state: 42P01
> Character: 15
> ========================================================
>
> We now get:
>
> ========================================================
> ERROR: ERROR: relation "pg_foo" does not exist
> LINE 1: select * from pg_foo
> ^
>
>
> ERROR: relation "pg_foo" does not exist
> SQL state: 42P01
> Character: 15
> ========================================================
>
> ​Done​

>
> --
> Dave Page
> Blog: http://pgsnake.blogspot.com
> Twitter: @pgsnake
>
> EnterpriseDB UK: http://www.enterprisedb.com
> The Enterprise PostgreSQL Company
>

Attachment Content-Type Size
add_testcases_history_tab_v3.diff text/plain 7.9 KB

In response to

Responses

Browse pgadmin-hackers by date

  From Date Subject
Next Message Dave Page 2017-09-19 08:21:35 Re: v2.0 RC2 test builds
Previous Message Surinder Kumar 2017-09-19 07:12:10 Re: v2.0 RC2 test builds