Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rf5ot-00FO6d-2q for pgsql-general@arkaria.postgresql.org; Tue, 27 Feb 2024 22:21:04 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1rf5or-006W2i-Hf for pgsql-general@arkaria.postgresql.org; Tue, 27 Feb 2024 22:21:02 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rf5op-006W2Z-Su for pgsql-general@lists.postgresql.org; Tue, 27 Feb 2024 22:21:01 +0000 Received: from wfout7-smtp.messagingengine.com ([64.147.123.150]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rf5ol-001cBJ-Dh for pgsql-general@lists.postgresql.org; Tue, 27 Feb 2024 22:20:59 +0000 Received: from compute6.internal (compute6.nyi.internal [10.202.2.47]) by mailfout.west.internal (Postfix) with ESMTP id 477651C0008D; Tue, 27 Feb 2024 17:20:54 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Tue, 27 Feb 2024 17:20:54 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= cc:content-transfer-encoding:content-type:content-type:date:date :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm3; t=1709072453; x=1709158853; bh=ts36IZNASS1Az6ID9crUFITIprQJWZ5KLabxLzsEIP8=; b= aJeOFt4TkymZemLdODLxILR/H2IzVTEdrI7w9I8s925GRk7WbHslCdAmSbURc6YP 9Lgp1N6braAgD+xejI4HIAlBALRgZ4sQdNrLU+AEXfNbgJA7sxnHffIPKk24eznk KHr/HUuClGEBCFBUDTDSzbAGPTXklfon2i1RPpowydBTfrYITkXi9OExDfuTciF5 mta5HtY0OzeDZvLyJ51ih27NWUCkUxbw7uWOcf/xHGJiq6ZbKWPq5Rl83tKbWT0d 1C2wxLJqmKJRHLNtIekfIq1MstPCQ6443n9CDXi6d0+HQd7QPqBd5mYKiDK2WF3a aKpJEaX3NH95/m6EViyAqw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1709072453; x= 1709158853; bh=ts36IZNASS1Az6ID9crUFITIprQJWZ5KLabxLzsEIP8=; b=o IXTovoXkJiem2ST/tpZhOsaiG8ZBSM4t4ybNMKHdL+Pz/SirHnDssLD5pPa2liaA muLoQWy+51Fi6R/nmgz1GbSFNMVrbFINdP9x62DgMXMXQSSw4Sa9yNrvrFLG7F+z lADNLr+9KCaIxi9+YEP7SS/KYvxabQGdyLmT2oZJ5OFn6z+vaSzIJfXCVggRMrW9 exA53/tsykUVe0/Sk9bQ+9GpkVxM/4QLAlHLGpEwL4pcZkMUZlH2ymm1sP6vVLXq GjKHz2lzMWCOI53JPqRE1gMCrSUmZkHfgaBCJoTXpvxc/wO8H4Xld/IsgI4sMwrY Vqm/6UBWHryFi53s954VA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrgeehgddufeehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepkfffgggfuffvfhfhjggtgfesthekredttddvjeenucfhrhhomheptegurhhi rghnucfmlhgrvhgvrhcuoegrughrihgrnhdrkhhlrghvvghrsegrkhhlrghvvghrrdgtoh hmqeenucggtffrrghtthgvrhhnpeffleegieefgfevudehtdfhkeeutdffjeevgeffgeej vedthefgudeiteefheejheenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmh grihhlfhhrohhmpegrughrihgrnhdrkhhlrghvvghrsegrkhhlrghvvghrrdgtohhm X-ME-Proxy: Feedback-ID: i76984098:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 27 Feb 2024 17:20:53 -0500 (EST) Message-ID: Date: Tue, 27 Feb 2024 14:20:52 -0800 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Me again with an insert trigger problem Content-Language: en-US To: Thiemo Kellner , "pgsql-general@lists.postgresql.org" References: <0eb1e688-009a-4eaf-873a-931e3fd79d6b@gelassene-pferde.biz> <72bb6841-7f48-4d0f-8dac-a36bdc24ec56@gelassene-pferde.biz> From: Adrian Klaver In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 2/27/24 14:11, Thiemo Kellner wrote: > Am 27.02.2024 um 21:42 schrieb Adrian Klaver: >> Also not sure what this: >> >> select NODE_TYPE⠒NAME into V⠒NODE_TYPE⠒NAME >>                from NODE⠒V >>               where 1 = 1 >>                 and ID = new.NODE⠒ID >>                 and 1 = 1; >> >> is supposed to be doing especially the 1 = 1 tests? > > The select retrieves the type of the node in order to determine whether > a task name must be given or not. > > It is a habit of mine to pad conditions in the where clause. This way, > it is easy to comment/uncomment parts of the clause for testing > purposes. Coming from Oracle, I missed that using "true" is also > possible and better because clearer. create table true_test(id integer); insert into true_test select * from generate_series(1, 10000); select count(*) from true_test where true; count ------- 10000 (1 row) select count(*) from true_test where id < 100 and true; count ------- 99 > >> Seems  '... where  ID = new.NODE⠒ID ...' is sufficient. > > Right. Semantically sufficient. > > >> Also what do you want to return as NEW? > > The unchanged new record. And it works as intended. > > Thanks for your help! > > -- Adrian Klaver adrian.klaver@aklaver.com