Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fdMLz-0003V7-OQ for pgsql-general@arkaria.postgresql.org; Wed, 11 Jul 2018 21:08:52 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fdMLx-0000rW-PV for pgsql-general@arkaria.postgresql.org; Wed, 11 Jul 2018 21:08:49 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fdMLx-0000rH-9r for pgsql-general@lists.postgresql.org; Wed, 11 Jul 2018 21:08:49 +0000 Received: from mail-yw0-x241.google.com ([2607:f8b0:4002:c05::241]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1fdMLt-0005BP-Ar for pgsql-general@postgresql.org; Wed, 11 Jul 2018 21:08:47 +0000 Received: by mail-yw0-x241.google.com with SMTP id l189-v6so9693041ywb.10 for ; Wed, 11 Jul 2018 14:08:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lucee-org.20150623.gappssmtp.com; s=20150623; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language; bh=nx8sVHtfFe9wV3VutoxtGA/oGgaQIirh1r/mQjDIp/8=; b=CYJSyDSfSPGaWFlFVlPpHcUsBkEe1ZFOXu4mC6jCg7QLVf+auPavykO28iDT1l0cZk +QAkW34o1vyda0HK0Lng2phNLsR6GdemyMK1Gfc4oa/7/zi6vI+SH/b03o9kOTuL5KBJ vBX9n8x2Ndgwm0FFIiXCqw9MWLnIe5bvv1UZtwlibBQOmu4j6QnSVKAGUuWPfz/tFxBJ IF2qfw3bOaiAO6GwgZCXYHNFqZIu6f+PdCkrgI/vYsE62//k0fjiCK/XLHvnHV7Qcvtn c1pJ/AElpNMl5Y0EHsxP2lqaYz84k9VxV5i7VlEOjxSiwED4uIl4FiRjh+yI+Qa+Vxex y/Sw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language; bh=nx8sVHtfFe9wV3VutoxtGA/oGgaQIirh1r/mQjDIp/8=; b=G2k1etgMVJ66/3U2FtJEBSwS5kqrs4ZXTPl+qM6/juDORaGcrF5wcCFRUT7isCx8LF HMC+CROlPKOravwpPjLRbBgiDeU1JiZoApj2XIzNs+Hck/oX1iD7v8vGIL0FfNZtla0L 9aoIL45vNbRJWybegbiEmvvKSS2jOVSBEyL/TdqCizAj+xmfbNqgFx/bvxTaki9rCOgZ D7X8BIbmWLuS3Vj/1zyycW40EFd7VuISeUQiWGzHlVFl1HhvQ8xYms623T87AuM+Lhfy mD/0UyObs/p2zHaiBYgaAM2i/xP9JB3X2V3xkLfBznKUNCEDr+wHSmp778mFIdRF3VZ8 Lh5w== X-Gm-Message-State: AOUpUlHGEUKg51Lq6aqFLwr8shq4ftnRMBXtUsvSULrxLY2Y4bxqBlE4 MMapCvpBk7rppmiYzmE6yVqgmeji X-Google-Smtp-Source: AAOMgpf+S9h+goZlu0e+Lg6Kolro0nlmPqV2DYIzdm50792ezqEQA5d7tt3dF/tiVCOnftXUI4bmDw== X-Received: by 2002:a81:4b83:: with SMTP id y125-v6mr151234ywa.14.1531343323873; Wed, 11 Jul 2018 14:08:43 -0700 (PDT) Received: from ?IPv6:2600:1700:4000:8120:796c:3217:5784:98f0? ([2600:1700:4000:8120:796c:3217:5784:98f0]) by smtp.googlemail.com with ESMTPSA id n3-v6sm3815217ywh.14.2018.07.11.14.08.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 11 Jul 2018 14:08:42 -0700 (PDT) Subject: Re: How to tell which event was fired in Trigger function To: "David G. Johnston" Cc: Adrian Klaver , pgsql-general References: <4fb09bff-b6db-e889-b4f0-9839bce44100@aklaver.com> <641dfb25-1103-1edf-b44e-cb8afc9f27cd@lucee.org> From: "Igal @ Lucee.org" Message-ID: <8130b2ce-9390-303b-db71-0704d175a186@lucee.org> Date: Wed, 11 Jul 2018 14:08:41 -0700 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/alternative; boundary="------------10B87BCE6DAAFA2485509325" Content-Language: en-US List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk This is a multi-part message in MIME format. --------------10B87BCE6DAAFA2485509325 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit On 7/11/2018 11:02 AM, David G. Johnston wrote: > On Wed, Jul 11, 2018 at 10:54 AM, Igal @ Lucee.org >wrote: > > On 7/11/2018 10:38 AM, Adrian Klaver wrote: > > On 07/11/2018 10:36 AM, Igal @ Lucee.org wrote: > > How can I tell inside the trigger function if the event > was DELETE or INSERT/UPDATE? > > > https://www.postgresql.org/docs/10/static/plpgsql-trigger.html > > > > This looks like it have all of the information that I need.  For > some reason search engines bring up many other pages but not that one. > > > ​For these situations I recommend bookmarking and navigating to the > Table of Contents [1] for the documentation and looking for relevant > chapter titles - in this case the "V. 38 - Triggers" one is right > there on the main page. > > https://www.postgresql.org/docs/10/static/index.html > > On a related note, maybe the pl/pgsql link from the Triggers chapter > should link directly to the Triggers section under pl/pgsql instead of > the top of the chapter... +1 Should link to ¶42.9 - https://www.postgresql.org/docs/10/static/plpgsql-trigger.html --------------10B87BCE6DAAFA2485509325 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 8bit On 7/11/2018 11:02 AM, David G. Johnston wrote:
On Wed, Jul 11, 2018 at 10:54 AM, Igal @ Lucee.org <igal@lucee.org> wrote:
On 7/11/2018 10:38 AM, Adrian Klaver wrote:
On 07/11/2018 10:36 AM, Igal @ Lucee.org wrote:
How can I tell inside the trigger function if the event was DELETE or INSERT/UPDATE?

https://www.postgresql.org/docs/10/static/plpgsql-trigger.html

This looks like it have all of the information that I need.  For some reason search engines bring up many other pages but not that one.

​For these situations I recommend bookmarking and navigating to the Table of Contents [1] for the documentation and looking for relevant chapter titles - in this case the "V. 38 - Triggers" one is right there on the main page.


On a related note, maybe the pl/pgsql link from the Triggers chapter should link directly to the Triggers section under pl/pgsql instead of the top of the chapter...

+1

Should link to ¶42.9 - https://www.postgresql.org/docs/10/static/plpgsql-trigger.html


--------------10B87BCE6DAAFA2485509325--