pgAdmin 4 commit: Add proper indentation to the code while generating f

2020-06-29 Thread Akshay Joshi
Add proper indentation to the code while generating functions, procedures, and 
trigger functions. Fixes #3851

Branch
--
master

Details
---
https://git.postgresql.org/gitweb?p=pgadmin4.git;a=commitdiff;h=7add777b21e09d5a5900fb05633b76b74419ea9d
Author: Rahul Shirsat 

Modified Files
--
docs/en_US/release_notes_4_24.rst  |  4 ++-
.../databases/schemas/functions/__init__.py| 31 ++
.../tests/pg/11_plus/alter_proc_comment.sql|  6 +++--
.../tests/pg/11_plus/alter_proc_param.sql  |  6 +++--
.../tests/pg/11_plus/alter_ptrig_comment.sql   |  6 +++--
.../tests/pg/11_plus/alter_ptrig_set_1.sql |  6 +++--
.../tests/pg/11_plus/alter_ptrig_set_2.sql |  6 +++--
.../tests/pg/11_plus/alter_ptrig_set_3.sql |  6 +++--
.../tests/pg/11_plus/create_event_trigger_full.sql |  6 +++--
.../tests/pg/11_plus/create_plain_trigger.sql  |  6 +++--
.../tests/pg/11_plus/create_plain_trigger_full.sql |  6 +++--
.../tests/pg/11_plus/create_procedure.sql  |  6 +++--
.../tests/pg/default/alter_ptrig_comment.sql   |  6 +++--
.../tests/pg/default/alter_ptrig_set_1.sql |  6 +++--
.../tests/pg/default/alter_ptrig_set_2.sql |  6 +++--
.../tests/pg/default/alter_ptrig_set_3.sql |  6 +++--
.../tests/pg/default/create_event_trigger_full.sql |  6 +++--
.../tests/pg/default/create_plain_trigger.sql  |  6 +++--
.../tests/pg/default/create_plain_trigger_full.sql |  6 +++--
.../tests/ppas/11_plus/alter_proc_comment.sql  |  6 +++--
.../tests/ppas/11_plus/alter_proc_param.sql|  6 +++--
.../tests/ppas/11_plus/alter_ptrig_comment.sql |  6 +++--
.../tests/ppas/11_plus/alter_ptrig_set_1.sql   |  6 +++--
.../tests/ppas/11_plus/alter_ptrig_set_2.sql   |  6 +++--
.../tests/ppas/11_plus/alter_ptrig_set_3.sql   |  6 +++--
.../ppas/11_plus/create_event_trigger_full.sql |  6 +++--
.../tests/ppas/11_plus/create_plain_trigger.sql|  6 +++--
.../ppas/11_plus/create_plain_trigger_full.sql |  6 +++--
.../tests/ppas/11_plus/create_procedure.sql|  6 +++--
.../tests/ppas/9.6_plus/alter_proc_comment.sql |  2 +-
.../tests/ppas/9.6_plus/alter_proc_opt.sql |  2 +-
.../tests/ppas/9.6_plus/alter_proc_opt_msql.sql|  2 +-
.../tests/ppas/9.6_plus/alter_proc_param.sql   |  2 +-
.../tests/ppas/9.6_plus/alter_ptrig_comment.sql|  6 +++--
.../tests/ppas/9.6_plus/alter_ptrig_set_1.sql  |  6 +++--
.../tests/ppas/9.6_plus/alter_ptrig_set_2.sql  |  6 +++--
.../tests/ppas/9.6_plus/alter_ptrig_set_3.sql  |  6 +++--
.../ppas/9.6_plus/create_event_trigger_full.sql|  6 +++--
.../tests/ppas/9.6_plus/create_plain_trigger.sql   |  6 +++--
.../ppas/9.6_plus/create_plain_trigger_full.sql|  6 +++--
.../tests/ppas/9.6_plus/create_procedure.sql   |  2 +-
.../tests/ppas/default/alter_proc_comment.sql  |  2 +-
.../tests/ppas/default/alter_proc_opt.sql  |  2 +-
.../tests/ppas/default/alter_proc_opt_msql.sql |  2 +-
.../tests/ppas/default/alter_proc_param.sql|  2 +-
.../tests/ppas/default/alter_ptrig_comment.sql |  6 +++--
.../tests/ppas/default/alter_ptrig_set_1.sql   |  6 +++--
.../tests/ppas/default/alter_ptrig_set_2.sql   |  6 +++--
.../tests/ppas/default/alter_ptrig_set_3.sql   |  6 +++--
.../ppas/default/create_event_trigger_full.sql |  6 +++--
.../tests/ppas/default/create_plain_trigger.sql|  6 +++--
.../ppas/default/create_plain_trigger_full.sql |  6 +++--
.../tests/ppas/default/create_procedure.sql|  2 +-
53 files changed, 208 insertions(+), 93 deletions(-)



Re: [pgAdmin][RM3851] Add proper indentation to the code when generating a stored procedure

2020-06-29 Thread Akshay Joshi
Thanks, patch applied.

On Sun, Jun 28, 2020 at 9:46 PM Rahul Shirsat <
rahul.shir...@enterprisedb.com> wrote:

> Corrected some indentations. Find the patch below.
>
> On Sun, Jun 28, 2020 at 9:21 PM Rahul Shirsat <
> rahul.shir...@enterprisedb.com> wrote:
>
>> Akshay,
>>
>> Ignore the above patch, reconsider this latest patch with some
>> optimizations.
>>
>> On Sat, Jun 27, 2020 at 1:50 AM Rahul Shirsat <
>> rahul.shir...@enterprisedb.com> wrote:
>>
>>> Hi Akshay,
>>>
>>> I have made the relevant changes for existing and the new procedure,
>>> functions & triggers.
>>>
>>> Please find the patch.
>>>
>>> On Thu, Jun 25, 2020 at 12:21 PM Akshay Joshi <
>>> akshay.jo...@enterprisedb.com> wrote:
>>>
 Hi Rahul

 I have tested your patch and the issue is not fixed. Create one
 Procedure, Function, and Trigger Function using below code *without*
 applying your patch:
 BEGIN
   SELECT 1;
 END;

 Then apply your patch and check the SQL tab.

 On Wed, Jun 24, 2020 at 12:41 AM Rahul Shirsat <
 rahul.shir...@enterprisedb.com> wrote:

> Hi Hackers,
>
> Please find the attached patch which fixes pg/ppas issues listed below:
>
>1. Stored procedure code indentation.
>2. Functions code indentation.
>3. Trigger Functions code indentation.
>
> Please review.
>
> --
> *Rahul Shirsat*
> Software Engineer | EnterpriseDB Corporation.
>


 --
 *Thanks & Regards*
 *Akshay Joshi*

 *Sr. Software Architect*
 *EnterpriseDB Software India Private Limited*
 *Mobile: +91 976-788-8246*

>>>
>>>
>>> --
>>> *Rahul Shirsat*
>>> Software Engineer | EnterpriseDB Corporation.
>>>
>>
>>
>> --
>> *Rahul Shirsat*
>> Software Engineer | EnterpriseDB Corporation.
>>
>
>
> --
> *Rahul Shirsat*
> Software Engineer | EnterpriseDB Corporation.
>


-- 
*Thanks & Regards*
*Akshay Joshi*

*Sr. Software Architect*
*EnterpriseDB Software India Private Limited*
*Mobile: +91 976-788-8246*


pgAdmin 4 commit: Fixed an issue where panels get disappeared. Regressi

2020-06-29 Thread Akshay Joshi
Fixed an issue where panels get disappeared. Regression of SonarQube fix.

Branch
--
master

Details
---
https://git.postgresql.org/gitweb?p=pgadmin4.git;a=commitdiff;h=102d6e7a9ae808cc8fd2238e0a1692ae754fecd2

Modified Files
--
web/pgadmin/utils/menu.py | 10 +-
1 file changed, 5 insertions(+), 5 deletions(-)



Re: Support schema level restrictions and edit connection properties when already connected.

2020-06-29 Thread Akshay Joshi
Hi Nikhil

Please fix below issues and resend the patch, I'll review once the
following will be fixed:

   - Fix PEP8.
   - Fix linter errors.
   - Your patch introduces some new sonarqube issues.
   - The database dialog width is 700px which is too wide, it should be
   600px
   - Add documentation about schema restriction and update the database
   dialog screenshot wherever applicable.
   - When we change the connection configuration for the server when it is
   already disconnected, a warning message should not come.
   - On refresh of the Schemas node, it is not expanded, the user will have
   to expand again. Provide some schema restriction and then change the schema
   name or remove the restriction to reproduce this issue.


On Fri, Jun 26, 2020 at 12:59 PM Nikhil Mohite <
nikhil.moh...@enterprisedb.com> wrote:

> Hi Team,
>
> PFA patch for  5583  support
> schema level restrictions and edit connection properties when already
> connected.
>
> Details as follows:
> 1. Schema restrictions :
>
> 1. Added a new tab "Advanced" in the database properties, with the "Schema
> restrictions" option it is similar to the "DB restrictions" in server
> properties.
>
> 2. Added new table  "databases" in the SQLite database, to store schema
> restrictions per database.
>
> 2. Edit connection properties when already connected:
>
> 1. Now allowing a user to edit server connection properties when the
> server is already connected, here the user will get a warning for
> disconnect and reconnect the server to apply the changes in configuration.
>
> Regards,
> Nikhil Mohite.
>


-- 
*Thanks & Regards*
*Akshay Joshi*

*Sr. Software Architect*
*EnterpriseDB Software India Private Limited*
*Mobile: +91 976-788-8246*


[pgAdmin4][patch] trigger's when clause related fixes

2020-06-29 Thread Zhang, Jie
Hi, all

[Incident]
'()' appears twice in  trigger's when clause?.

[scenario 1]
The step is as follow:
1) The SQL to create the trigger is as follows.
-
CREATE TRIGGER trigger1
BEFORE UPDATE
ON public.tab1
FOR EACH ROW
WHEN (new.a IS NOT NULL)
EXECUTE PROCEDURE public.func();
-
2) Right click  trigger1
3) Click CREATE Script
The SQL shown in 'Query Editor' is as follows.
-
CREATE TRIGGER trigger1
BEFORE UPDATE
ON public.tab1
FOR EACH ROW
WHEN ((new.a IS NOT NULL))# () appears twice.
EXECUTE PROCEDURE public.func();


[scenario 2]
1) Right click  trigger1
2) Click Properties...
3) Click Event tab
The SQL shown in 'When' is as follows.
((new.a IS NOT NULL))     # () appears twice.

[The detail of cause]
pg_get_triggerdef(trigger_oid, pretty_bool)  get CREATE [ CONSTRAINT ] TRIGGER 
command for trigger

Parameter true missing in pg_get_triggerdef function.

SELECT t.oid,t.tgname AS name, t.xmin, t.tgenabled AS is_enable_trigger, t.*, 
relname, CASE WHEN relkind = 'r' THEN TRUE ELSE FALSE END AS parentistable,
nspname, des.description, l.lanname, p.prosrc, p.proname AS tfunction,
COALESCE(substring(pg_get_triggerdef(t.oid), 'WHEN (.*) EXECUTE 
(PROCEDURE|FUNCTION)'),
substring(pg_get_triggerdef(t.oid), 'WHEN (.*)  \$trigger')) AS whenclause,

pgadmin4\web\pgadmin\browser\server_groups\servers\databases\schemas\tables\templates\triggers\sql\pg\10_plus\properties.sql

[The summary of correction]
pg_get_triggerdef(t.oid) => pg_get_triggerdef(t.oid, true)

Here is a patch for trigger's when clause.
Please review.


Best Regards!?






whenclause.patch
Description: whenclause.patch


Patch for SonarQube code scan fixes

2020-06-29 Thread Nikhil Mohite
Hi Team,

I have fixed some code smell issues in the SonarQube scan, PFA patch.
Details as follows:
1. Sequences files:

   - Refactor this function to reduce its Cognitive Complexity from 33 to
   the 15 allowed.
   - Refactor this function to reduce its Cognitive Complexity from 16 to
   the 15 allowed.
   - Refactor this function to reduce its Cognitive Complexity from 16 to
   the 15 allowed.

2. Functions files:

   - Refactor this function to reduce its Cognitive Complexity from 141 to
   the 15 allowed.
   - Refactor this function to reduce its Cognitive Complexity from 42 to
   the 15 allowed.
   - Refactor this function to reduce its Cognitive Complexity from 43 to
   the 15 allowed.


sonarQubeCodeSmellFixes.patch
Description: Binary data


Re- [SonarQube][patch]- codesmell

2020-06-29 Thread Satish V
Hi Hackers,

Please find the patch which fixes the code smell issues related to the rule
"Variables should not be shadowed".

Thanks,
Sathish V


Variables_should_not_be_shadowed.patch
Description: Binary data