Thread: [pgAdmin4][patch] Remove extra brackets in CREATE Script and DDL Comparison
[pgAdmin4][patch] Remove extra brackets in CREATE Script and DDL Comparison
From
"zhangjie2@fujitsu.com"
Date:
Hi, all Extra brackets appear in CREATE Script and DDL Comparison, please refer to the attachment error1.png and error2.png for details. ■ scenario The step is as follow: 1) Connect to pg9.6 or pg9.5 2) The SQL to create the trigger is as follows. --------------------------------------------- CREATE TRIGGER tg1 BEFORE INSERT ON public.tb1 FOR EACH ROW WHEN (new.c1 > 0) EXECUTE PROCEDURE public.tf1(); --------------------------------------------- 3) Right click tg1 4) Click CREATE Script The SQL shown in 'Query Editor' is as follows. --------------------------------------------- CREATE TRIGGER tg1 BEFORE INSERT ON public.tb1 FOR EACH ROW WHEN ((new.c1 > 0)) brackets appears twice. EXECUTE PROCEDURE public.tf1(); ------------------------------------------------ ■ The detail of cause: file: web\pgadmin\browser\server_groups\servers\databases\schemas\tables\templates\triggers\sql\pg\default\create.sql WHEN ({{ data.whenclause }}){% endif %} There are already brackets in data.whenclause. ■ The summary of correction file: web\pgadmin\browser\server_groups\servers\databases\schemas\tables\templates\triggers\sql\pg\default\create.sql - WHEN ({{ data.whenclause }}){% endif %} + WHEN {% if not data.oid %}({% endif %}{{ data.whenclause }}{% if not data.oid %}){% endif %}{% endif %} Refer to the following code for the correction method. file: web\pgadmin\browser\server_groups\servers\databases\schemas\tables\templates\triggers\sql\pg\10_plus\create.sql WHEN {% if not data.oid %}({% endif %}{{ data.whenclause }}{% if not data.oid %}){% endif %}{% endif %} Here is a patch for create.sql Please review. Best Regards! Zhangjie
Attachment
Re: [pgAdmin4][patch] Remove extra brackets in CREATE Script and DDL Comparison
From
Khushboo Vashi
Date:
Patch looks good to me.
Hi, all
Extra brackets appear in CREATE Script and DDL Comparison,
please refer to the attachment error1.png and error2.png for details.
■ scenario
The step is as follow:
1) Connect to pg9.6 or pg9.5
2) The SQL to create the trigger is as follows.
---------------------------------------------
CREATE TRIGGER tg1
BEFORE INSERT
ON public.tb1
FOR EACH ROW
WHEN (new.c1 > 0)
EXECUTE PROCEDURE public.tf1();
---------------------------------------------
3) Right click tg1
4) Click CREATE Script
The SQL shown in 'Query Editor' is as follows.
---------------------------------------------
CREATE TRIGGER tg1
BEFORE INSERT
ON public.tb1
FOR EACH ROW
WHEN ((new.c1 > 0)) brackets appears twice.
EXECUTE PROCEDURE public.tf1();
------------------------------------------------
■ The detail of cause:
file: web\pgadmin\browser\server_groups\servers\databases\schemas\tables\templates\triggers\sql\pg\default\create.sql
WHEN ({{ data.whenclause }}){% endif %}
There are already brackets in data.whenclause.
■ The summary of correction
file: web\pgadmin\browser\server_groups\servers\databases\schemas\tables\templates\triggers\sql\pg\default\create.sql
- WHEN ({{ data.whenclause }}){% endif %}
+ WHEN {% if not data.oid %}({% endif %}{{ data.whenclause }}{% if not data.oid %}){% endif %}{% endif %}
Refer to the following code for the correction method.
file: web\pgadmin\browser\server_groups\servers\databases\schemas\tables\templates\triggers\sql\pg\10_plus\create.sql
WHEN {% if not data.oid %}({% endif %}{{ data.whenclause }}{% if not data.oid %}){% endif %}{% endif %}
Here is a patch for create.sql
Please review.
Best Regards!
Zhangjie
Re: [pgAdmin4][patch] Remove extra brackets in CREATE Script and DDL Comparison
From
Akshay Joshi
Date:
Thanks, the patch applied.
Hi, all
Extra brackets appear in CREATE Script and DDL Comparison,
please refer to the attachment error1.png and error2.png for details.
■ scenario
The step is as follow:
1) Connect to pg9.6 or pg9.5
2) The SQL to create the trigger is as follows.
---------------------------------------------
CREATE TRIGGER tg1
BEFORE INSERT
ON public.tb1
FOR EACH ROW
WHEN (new.c1 > 0)
EXECUTE PROCEDURE public.tf1();
---------------------------------------------
3) Right click tg1
4) Click CREATE Script
The SQL shown in 'Query Editor' is as follows.
---------------------------------------------
CREATE TRIGGER tg1
BEFORE INSERT
ON public.tb1
FOR EACH ROW
WHEN ((new.c1 > 0)) brackets appears twice.
EXECUTE PROCEDURE public.tf1();
------------------------------------------------
■ The detail of cause:
file: web\pgadmin\browser\server_groups\servers\databases\schemas\tables\templates\triggers\sql\pg\default\create.sql
WHEN ({{ data.whenclause }}){% endif %}
There are already brackets in data.whenclause.
■ The summary of correction
file: web\pgadmin\browser\server_groups\servers\databases\schemas\tables\templates\triggers\sql\pg\default\create.sql
- WHEN ({{ data.whenclause }}){% endif %}
+ WHEN {% if not data.oid %}({% endif %}{{ data.whenclause }}{% if not data.oid %}){% endif %}{% endif %}
Refer to the following code for the correction method.
file: web\pgadmin\browser\server_groups\servers\databases\schemas\tables\templates\triggers\sql\pg\10_plus\create.sql
WHEN {% if not data.oid %}({% endif %}{{ data.whenclause }}{% if not data.oid %}){% endif %}{% endif %}
Here is a patch for create.sql
Please review.
Best Regards!
Zhangjie
Thanks & Regards
Akshay Joshi
pgAdmin Hacker | Principal Software Architect
EDB PostgresMobile: +91 976-788-8246