Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hdqsP-0003pH-BB for pgadmin-hackers@arkaria.postgresql.org; Thu, 20 Jun 2019 06:48:53 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hdqsN-0001zt-J1 for pgadmin-hackers@arkaria.postgresql.org; Thu, 20 Jun 2019 06:48:51 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hdqsN-0001xD-5U for pgadmin-hackers@lists.postgresql.org; Thu, 20 Jun 2019 06:48:51 +0000 Received: from mail-qt1-x834.google.com ([2607:f8b0:4864:20::834]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hdqsJ-0007zP-Rz for pgadmin-hackers@postgresql.org; Thu, 20 Jun 2019 06:48:50 +0000 Received: by mail-qt1-x834.google.com with SMTP id w17so2091395qto.10 for ; Wed, 19 Jun 2019 23:48:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=enterprisedb-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=6NvTCsrRnty5x8LCO33nZoEEQT+YeD0OxoYwVAMPAl4=; b=SVQN9nQ4nFPZJXkAcaYU6Oz1R7Tsfk1HUpwibBW3qMYdJkHG45hS4gT3GbRYurlDPW /v35gzb2my0cVN5T09IKFLFG+bJR4AP+FD8no4FPLjHzQduzN7V3OWBd7+QRvr5FcL9H HaeHd/mW/AJFFt8v91t6SgFQG9t9+ITD1WcrwHG/0l8C6MLe51Y6SboiD03ia+OjLQcU wAFgkaWFWTiTrq+l1vPtqOAzA9DpCBEHW0t5nSjLV0CjVdyH/MimDrlkSgE5RaNKEk3Q KZPXj3VgTduc2VPRmmJDTps+yakAVCTPDtLHosz6kSYATyy97GvGLTZmbXIMl/WVN5W3 sK7w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=6NvTCsrRnty5x8LCO33nZoEEQT+YeD0OxoYwVAMPAl4=; b=ERGe9cwSkFNRmmv+kNdpNnIm8LOpSMpp/Z0cgW7xFWIeNX/4ye3OFCbzkTqcnUzmIJ 8omocBQ4mb+1ckFhx5SdntB4ci8q7m2TTINOUfG+k9lP494zHa8BxCLI3ESL387NyvZR zQbGTpzNBYs13w7VbWzgkqazUQdzM1IeUUG6JSDW/Dp42NXczpXn/g2uUu0rnYKHyWz5 dnXj3hr4LobsSuMzIZZXwDM6WVNc4JhDrHrrdST+DPzvDX05FdLZR7ohbXrPpnubuyuE 572zqMbXAmgLV+hjuseMq6QHPsE3g9OYEOIXa46ttRt2JSaaNspM221NiUNyrpJOrzpz loiQ== X-Gm-Message-State: APjAAAW+fGXmL1tTXdUHJrziCvV18fqr/X+V5QFApa0AJji6NFqgUSjW gOIjtT9S+vgbNyjCoXevmK5f93dzC7jiXhUBqlqyPq8N X-Google-Smtp-Source: APXvYqzQdyVwjOV9zKfdw52gt+oe4gtdFuu1pZYdwhdEplv+pr3o3NwlEus/L7rojKN30PXa3q6Qy7MKHXgm2HiIe5g= X-Received: by 2002:ac8:18b2:: with SMTP id s47mr108862334qtj.75.1561013325626; Wed, 19 Jun 2019 23:48:45 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Akshay Joshi Date: Thu, 20 Jun 2019 12:18:34 +0530 Message-ID: Subject: Re: [pgAdmin4][Patch]: RM #4362 trigger function create script To: Dave Page Cc: pgadmin-hackers Content-Type: multipart/alternative; boundary="000000000000c39483058bbbbcdf" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --000000000000c39483058bbbbcdf Content-Type: text/plain; charset="UTF-8" Hi Dave On Wed, Jun 19, 2019 at 8:47 PM Akshay Joshi wrote: > Hi Dave > > On Wed, 19 Jun, 2019, 19:57 Dave Page, wrote: > >> 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)? >> > > 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* --000000000000c39483058bbbbcdf Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi=C2=A0Dave

On Wed, Jun 19, 2019 at 8:47 = PM Akshay Joshi <akshay= .joshi@enterprisedb.com> wrote:
Hi=C2=A0Dave

On Wed, 19 Jun, 201= 9, 19:57 Dave Page, <dpage@pgadmin.org> wrote:
Hi

<= div class=3D"gmail_quote">
On Wed, Jun= 19, 2019 at 9:55 AM Akshay Joshi <akshay.joshi@en= terprisedb.com> wrote:
Hi Hackers,

Attached is t= he patch to fix RM #4362 trigger function create script.=C2=A0
Pl= ease review it.

While I can see= how this works, I question why we have the string "SETOF" in pro= rettypname anyway? That's a separate property, so it should be in a sep= arate variable. What if I have a type called "SETOFDavesStuff" (u= nlikely, but it illustrates the point)?

=C2=A0 =C2=A0 We have = used pg_get_function_result(func_oid) to get the returns clause for functio= n and assign its value to prorettypename variable. I have followed the same= logic for trigger function and fixed it. Similar logic has already been us= ed for functions.=C2=A0

=C2=A0 = =C2=A0 I have tested it with two different type "SETOF TypeTest" = and "SETOFType" for function, as trigger_function only have retur= n type either trigger or event_trigger. I haven't found any issue with = the reverse engineered sql and create script as well.=C2=A0

--
Dave Page
Blog: http://pgsnake.blogspot.com
T= witter: @pgsnake

EnterpriseDB UK: http://www.enterprise= db.com
The Enterprise PostgreSQL Company


--
Thanks & Regards
=
Akshay Joshi
Sr. Software Architect
EnterpriseDB Software India Private Limited
=
Mobile: += 91 976-788-8246
--000000000000c39483058bbbbcdf--