Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1m8WN7-0005u3-Nk for pgsql-novice@arkaria.postgresql.org; Tue, 27 Jul 2021 23:20:25 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1m8WN6-0001gG-FE for pgsql-novice@arkaria.postgresql.org; Tue, 27 Jul 2021 23:20:24 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1m8WN6-0001g8-6c for pgsql-novice@lists.postgresql.org; Tue, 27 Jul 2021 23:20:24 +0000 Received: from mail-pl1-x62e.google.com ([2607:f8b0:4864:20::62e]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1m8WMz-0001iR-Ow for pgsql-novice@lists.postgresql.org; Tue, 27 Jul 2021 23:20:23 +0000 Received: by mail-pl1-x62e.google.com with SMTP id i1so367187plr.9 for ; Tue, 27 Jul 2021 16:20:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=4bwbXSzYeJXxBjq96uxt6N8BjOcMhlysSmIKvDCmSxc=; b=tR83/E1bhrKshA7HwQrAYQ1mFlAHyvZoUBxqBDIq2ZFZkXP8kDLecLMqecXvOys2ie 8EskZ7J8iCVVJB9IgsYulFRtEhOPbwpBt/p4+P2FpYbwpwuFtd70OerUSa8tk/Vz/+sT +xgQoMgCVHA9RwQhCtxQNhu/Zdkl4asLlD1kQGEpWq84lQABCnp32C/r35xHPSfC3BqG jYPeY99bpd+h5PD7VuLMThmiAwlcdIN27TY4FQu3KNq/8NNXP19BB6JTVt/MFvf1ynjz y6UWNVsUJ8CTeXWNflSHlvdyl2MHFHwIU7qCscYoTexv0JvnXEHYXUXlN2xzlFERfrJB 87bw== 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=4bwbXSzYeJXxBjq96uxt6N8BjOcMhlysSmIKvDCmSxc=; b=RDiSNJcfNoAjFJMClYQtii08adtQdLbof9htUb8QnyccF3HZqUXATbtI/geZJD6Z7A E3Yqr1QXuOwnZUXU5L2NFoLotfixv96Rq8CjXjmHo2Ra9/oSoacQ69abAMkeQH96OG+T jIIbzXChHAo1kNQeZmSya7xsDYWtPbthUVtkzojbmt9YbIR+suhpBHAMJXsvPkzSArQ9 IhuCC1FMD82I1Y88qOFdsFJLL+yOVn6/nITyF2q+rSJNc05bEaqbgKOn+B6KgFsrOnXZ qgJH/P2E1sctUCpVQVpKAApjy3IA+RcbTRninnwqxiRZET5/c6HDkH4MZwwnYolkJH0q 4d0Q== X-Gm-Message-State: AOAM533v5zf2bVHo3QS2c9sqGBxcz0aDIf9pM51rXMgdgknw1cnA+dpD T8A5lSjS66vSQiPyp4K7LBpz+KdUX0PmHQviWw0= X-Google-Smtp-Source: ABdhPJxWeKnxz9lacDeEyZC+wJC+jAlhY/UGpM+lemesQ4jvCVtXCiKBgvrsTKkJHxxwno/fLk1mRGxDTe5BWQfss4U= X-Received: by 2002:a63:1960:: with SMTP id 32mr25960693pgz.86.1627428015548; Tue, 27 Jul 2021 16:20:15 -0700 (PDT) MIME-Version: 1.0 References: <30B8A3D0-8A87-40E2-BE40-31A17BA4B944@posteo.net> <20210727063805.GA28983@depesz.com> <2D1DF30A-25BC-48CA-B502-D8B3147B9BEB@posteo.net> <53180757-855C-4FFF-B5CC-572BAEFD9397@posteo.net> In-Reply-To: <53180757-855C-4FFF-B5CC-572BAEFD9397@posteo.net> From: "David G. Johnston" Date: Tue, 27 Jul 2021 16:19:57 -0700 Message-ID: Subject: Re: Trigger function To: Nicolas Mitchell Cc: hubert depesz lubaczewski , pgsql-novice Content-Type: multipart/alternative; boundary="000000000000c3abb105c8231c12" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --000000000000c3abb105c8231c12 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Tue, Jul 27, 2021 at 4:04 PM Nicolas Mitchell wrote: > > > When you write a trigger for a table you should be executing commands > > against the same table. > > I believe this implies that the code creating a new object (INSERT INTO > public.object=E2=80=A6) row should reside elsewhere. > > Since the trigger is on host but the insert is going to object my observation does not apply. Personally, I'm generally against placing this kind of data construction logic inside triggers. David J. --000000000000c3abb105c8231c12 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Tue, Jul 27, 2021 at 4:04 PM Nicolas Mitchell <mitchelln@posteo.net> wrote:

> When you write a trigger for a table you should be executing commands<= br> > against the same table.

I believe this implies that the code creating a new object (INSERT INTO public.object=E2=80=A6) row should reside elsewhere.


Since the trigger is on host but the insert is going to obj= ect my observation does not apply.

Personally, I'= m generally against placing this kind of data construction logic inside tri= ggers.

David J.

--000000000000c3abb105c8231c12--