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 1hdw2x-0000x3-7S for pgadmin-hackers@arkaria.postgresql.org; Thu, 20 Jun 2019 12:20:07 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hdw2w-0007uz-3c for pgadmin-hackers@arkaria.postgresql.org; Thu, 20 Jun 2019 12:20:06 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hdw2v-0007us-Pq for pgadmin-hackers@lists.postgresql.org; Thu, 20 Jun 2019 12:20:05 +0000 Received: from mail-wr1-x442.google.com ([2a00:1450:4864:20::442]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hdw2o-0002tJ-Sp for pgadmin-hackers@postgresql.org; Thu, 20 Jun 2019 12:20:04 +0000 Received: by mail-wr1-x442.google.com with SMTP id p11so2799787wre.7 for ; Thu, 20 Jun 2019 05:19:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pgadmin.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=X5l0afZnwc1aOpr4tgj65yyhZwRegZlrhyxajE8c8Pk=; b=XW41hwyuIgBvXzN+VGZymGJA/x80W+0pFIvUnX+CdCcoafF0TlbpBeWc5UUyhbUOBY H998OF1NQGlCI9MqaOBK7BGJlmxx6klacQgIOECyW5JMDn7NmqduRCwnIj5NsKMje9He x5TdXKGU74yOG49DiChSCBCeGb6UueVq2AnmTx1C+pfVdT0MG4Ru7CU9hmM3MdI2ZeW3 rqVL0KgngB1aKhQsg20B4UdB1L9tlvT3uOZUjqAb++ZwRuPJpcd6p606CF/QnErxSk+W mD98ezc4J3EfkBG9bg7KWtShTnj/pKNwMSvXkVV5/DtGLT7raVJ9MkIGZ5e0+SotuCAk r5mw== 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=X5l0afZnwc1aOpr4tgj65yyhZwRegZlrhyxajE8c8Pk=; b=IgRJo8d5MnEatQx4QGN2nqoBsjduo2ahhEhrFviZR59Bq8W3ae74Lw425t1leI0ABw ZJ38j9nVoFRkCNxqt1U0pXXCny9mA6ENHTXr2Aj1ycGRXGhmX7dj3pQQkEgJzwzDHMHI h3nJYTW1K1EBwN3r13pzJo90N0eIoNq0DxPFPkugGCGW/w+BHNN0xwFLH9TAKgKLKB9S VoEliodNqt4AaOXGSx6GXzyUYqQ2vkqojqnfYcRR0JZwGF+Gi3zfk8Us4LlJmp2czIcO hDnXWo0zTztLP3WazuBQ+yPKx4Jd70do9hS+XEmLowQoaIKs+/vOXWYS96cWitFBOWtM XHKg== X-Gm-Message-State: APjAAAWJSKHNceA/txDt9Fn9U0nil7R3UgRnu2rhogH8vktqg/iP9UrA M4jleA811VjAgA5l6isuSI/T+Uku6T69XI5OCtmVSw== X-Google-Smtp-Source: APXvYqw8sriVuyuommxX1gOA48R47penSmJcvli/bNIUcsVYOy3kIIYfA0RJIm7d92WwtUbUD81PvluccUwNEDF+U2s= X-Received: by 2002:a05:6000:106:: with SMTP id o6mr14702571wrx.4.1561033196636; Thu, 20 Jun 2019 05:19:56 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Dave Page Date: Thu, 20 Jun 2019 13:19:44 +0100 Message-ID: Subject: Re: [pgAdmin4][Patch]: RM #4362 trigger function create script To: Akshay Joshi Cc: pgadmin-hackers Content-Type: multipart/alternative; boundary="0000000000002b1fae058bc05dd4" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --0000000000002b1fae058bc05dd4 Content-Type: text/plain; charset="UTF-8" Thanks, applied. On Thu, Jun 20, 2019 at 7:48 AM Akshay Joshi wrote: > Hi Dave > > On Wed, Jun 19, 2019 at 8:47 PM Akshay Joshi < > akshay.joshi@enterprisedb.com> 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* > -- Dave Page Blog: http://pgsnake.blogspot.com Twitter: @pgsnake EnterpriseDB UK: http://www.enterprisedb.com The Enterprise PostgreSQL Company --0000000000002b1fae058bc05dd4 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Thanks, applied.

On Thu, Jun 20, 2019 at 7:48 AM Akshay Jos= hi <akshay.joshi@enterp= risedb.com> wrote:
Hi=C2=A0Dave

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

On Wed, 19 Jun, 2019, 19:57 Dave Page, <dpage@pgadmin.org&g= t; 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 cre= ate script.=C2=A0
Please review it.
=
While I can see how this works, I question why we have the s= tring "SETOF" in prorettypname anyway? That's a separate prop= erty, so it should be in a separate variable. What if I have a type called = "SETOFDavesStuff" (unlikely, but it illustrates the point)?
=

=C2=A0 =C2=A0 We have used pg_get_function_result(func_oid) to ge= t the returns clause for function and assign its value to prorettypename va= riable. I have followed the same logic for trigger function and fixed it. S= imilar logic has already been used 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 return type either trigger or event_trigger. I h= aven't found any issue with the reverse engineered sql and create scrip= t as well.=C2=A0

--
<= div dir=3D"ltr" class=3D"gmail-m_2981777136249385672gmail-m_-89981435976675= 23670m_-8396316296880597531m_-8045082179897863750gmail_signature">Dave Page=
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake=

EnterpriseDB UK: http://www.enterprisedb.com
Th= e Enterprise PostgreSQL Company


--
<= div>Thanks & Rega= rds
Akshay Joshi
Sr. Software Architect
=
EnterpriseDB Software India Private Limited<= /b>
Mobile: +91 976-788-8246
=


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

EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL = Company
--0000000000002b1fae058bc05dd4--