Thread: [pgAdmin4][Patch]: RM #4362 trigger function create script
Hi Hackers,
Attached is the patch to fix RM #4362 trigger function create script.
Please review it.
--
Thanks & Regards
Akshay Joshi
Sr. Software Architect
EnterpriseDB Software India Private Limited
Mobile: +91 976-788-8246
Attachment
Hi
On Wed, Jun 19, 2019 at 9:55 AM Akshay Joshi <akshay.joshi@enterprisedb.com> wrote:
Hi Hackers,Attached is the patch to fix RM #4362 trigger function create script.Please review it.
While I can see how this works, I question why we have the string "SETOF" in prorettypname anyway? That's a separate property, so it should be in a separate variable. What if I have a type called "SETOFDavesStuff" (unlikely, but it illustrates the point)?
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
Hi Dave
On Wed, 19 Jun, 2019, 19:57 Dave Page, <dpage@pgadmin.org> wrote:
HiOn Wed, Jun 19, 2019 at 9:55 AM Akshay Joshi <akshay.joshi@enterprisedb.com> wrote:Hi Hackers,Attached is the patch to fix RM #4362 trigger function create script.Please review it.While I can see how this works, I question why we have the string "SETOF" in prorettypname anyway? That's a separate property, so it should be in a separate variable. What if I have a type called "SETOFDavesStuff" (unlikely, but it illustrates the point)?
We have used pg_get_function_result(func_oid) to get the returns clause for function and assign its value to prorettypename variable. I have followed the same logic for trigger function and fixed it. Similar logic has already been used for functions.
--Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake
EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
Hi Dave
On Wed, Jun 19, 2019 at 8:47 PM Akshay Joshi <akshay.joshi@enterprisedb.com> wrote:
Hi DaveOn Wed, 19 Jun, 2019, 19:57 Dave Page, <dpage@pgadmin.org> wrote:HiOn Wed, Jun 19, 2019 at 9:55 AM Akshay Joshi <akshay.joshi@enterprisedb.com> wrote:Hi Hackers,Attached is the patch to fix RM #4362 trigger function create script.Please review it.While I can see how this works, I question why we have the string "SETOF" in prorettypname anyway? That's a separate property, so it should be in a separate variable. What if I have a type called "SETOFDavesStuff" (unlikely, but it illustrates the point)?We have used pg_get_function_result(func_oid) to get the returns clause for function and assign its value to prorettypename variable. I have followed the same logic for trigger function and fixed it. Similar logic has already been used for functions.
I have tested it with two different type "SETOF TypeTest" and "SETOFType" for function, as trigger_function only have return type either trigger or event_trigger. I haven't found any issue with the reverse engineered sql and create script as well.
--Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake
EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
Thanks & Regards
Akshay Joshi
Sr. Software Architect
EnterpriseDB Software India Private Limited
Mobile: +91 976-788-8246
Thanks, applied.
On Thu, Jun 20, 2019 at 7:48 AM Akshay Joshi <akshay.joshi@enterprisedb.com> wrote:
Hi DaveOn Wed, Jun 19, 2019 at 8:47 PM Akshay Joshi <akshay.joshi@enterprisedb.com> wrote:Hi DaveOn Wed, 19 Jun, 2019, 19:57 Dave Page, <dpage@pgadmin.org> wrote:HiOn Wed, Jun 19, 2019 at 9:55 AM Akshay Joshi <akshay.joshi@enterprisedb.com> wrote:Hi Hackers,Attached is the patch to fix RM #4362 trigger function create script.Please review it.While I can see how this works, I question why we have the string "SETOF" in prorettypname anyway? That's a separate property, so it should be in a separate variable. What if I have a type called "SETOFDavesStuff" (unlikely, but it illustrates the point)?We have used pg_get_function_result(func_oid) to get the returns clause for function and assign its value to prorettypename variable. I have followed the same logic for trigger function and fixed it. Similar logic has already been used for functions.I have tested it with two different type "SETOF TypeTest" and "SETOFType" for function, as trigger_function only have return type either trigger or event_trigger. I haven't found any issue with the reverse engineered sql and create script as well.--Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake
EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company--Thanks & RegardsAkshay JoshiSr. Software ArchitectEnterpriseDB Software India Private LimitedMobile: +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