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 1hdcKu-0003T8-0k for pgadmin-hackers@arkaria.postgresql.org; Wed, 19 Jun 2019 15:17:20 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hdcKs-0003Do-SQ for pgadmin-hackers@arkaria.postgresql.org; Wed, 19 Jun 2019 15:17:18 +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 1hdcKs-0003Dh-GK for pgadmin-hackers@lists.postgresql.org; Wed, 19 Jun 2019 15:17:18 +0000 Received: from mail-qt1-x833.google.com ([2607:f8b0:4864:20::833]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hdcKp-0003tI-5q for pgadmin-hackers@postgresql.org; Wed, 19 Jun 2019 15:17:17 +0000 Received: by mail-qt1-x833.google.com with SMTP id x2so20367664qtr.0 for ; Wed, 19 Jun 2019 08:17:14 -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=jISUT/5ZAqYKeDW+PmtCaY1n8lDBr7ZuqVKd3jpnsWo=; b=bnW330nXzPt3nR1hILp0r/Uy86RMzVTuSyNywNGrIGObwmC7lTYDzpwl1UsfdLJUhz wX3AmvxEIhiHCix9KFx9rG8A5QGuxhDsiDbTGl97HozH2SLN52QpmOtnl4lY8dGwmsD1 2ts4mmeE6d5U+xR1MrpH1AL7xFOz3fbsR3LmVsBUADAJTcnXoXSMu+Qyb2Y6K3yv4Ogl q+S1rtryVUefj1+80r1lzHFQJuI41IIvSJALoso5DXDJXR5znvsifo5y2iD7y9YfIr9O MPSW4ry9vubbBvswR70unsBY5EEDsN0U3sUsa+EydanOCme+o/cBZgRlIhpFruGGXpey avCQ== 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=jISUT/5ZAqYKeDW+PmtCaY1n8lDBr7ZuqVKd3jpnsWo=; b=MYVqF7U7iozCjAZdHNBZvsQOlT3x+MFiwWAV702xfviY1GSO2Xg5C4HB51OhswphMV yDu10OzDeFEuX1oU666Ire8ORcmSIKPAynkqWEfSgSzeylG7j/rdLsEkxRyLCg4PKe9q ccZyEfE5W0WxvxBPJsACJGOevLaaP7ya8myrzI1WnbM7oNbmmMpQDWvcdlqKDWX2MGZV cFs+3yNOIOJO+zFU85hoIOHK4oKqbCG9AK8X6aWQTA7vEUmB8g4mggfZCPxG8I8MeC+C itviORaI+6663JrFsZINkZEfkIuNSS27dDPuMQvlsy31McndXV6AKNssZ2WyIiFtLOOU fhlg== X-Gm-Message-State: APjAAAUVewOWC5tn2Sn6yNozL5H8Y50oSVNQBn1PPFbUFNipLQrJzdz7 FffHkwBiXcI4mYpNQg35j/ISslXlCeLpDSoO+S5tLg== X-Google-Smtp-Source: APXvYqxIdt9NiPTH3wYsT25sdcRDSxeYuweTOmfXNPP4ciX6QuX9xiup/aWs6mr9/B9qaX0/WV+Xk8tJgr1vd68gQ7Y= X-Received: by 2002:ac8:4413:: with SMTP id j19mr12394772qtn.281.1560957432684; Wed, 19 Jun 2019 08:17:12 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Akshay Joshi Date: Wed, 19 Jun 2019 20:47:01 +0530 Message-ID: Subject: Re: [pgAdmin4][Patch]: RM #4362 trigger function create script To: Dave Page Cc: pgadmin-hackers Content-Type: multipart/alternative; boundary="00000000000048fdd7058baeb932" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --00000000000048fdd7058baeb932 Content-Type: text/plain; charset="UTF-8" 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. > > -- > Dave Page > Blog: http://pgsnake.blogspot.com > Twitter: @pgsnake > > EnterpriseDB UK: http://www.enterprisedb.com > The Enterprise PostgreSQL Company > --00000000000048fdd7058baeb932 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi=C2=A0Dave

On Wed, 19 Jun, 2019, 19:57 Dave Page, <= ;= dpage@pgadmin.org> 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.=C2=A0
Please review it.

While I can see how this works, I question why we have th= e string "SETOF" in prorettypname anyway? That's a separate p= roperty, so it should be in a separate variable. What if I have a type call= ed "SETOFDavesStuff" (unlikely, but it illustrates the point)?

=C2=A0 =C2=A0 We have used pg_get_function_result(func_oid) to g= et the returns clause for function and assign its value to prorettypename v= ariable. I have followed the same logic for trigger function and fixed it. = Similar logic has already been used for functions.=C2=A0

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

EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Co= mpany
--00000000000048fdd7058baeb932--