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 1qH4Vx-0003Wf-IK for pgsql-general@arkaria.postgresql.org; Wed, 05 Jul 2023 15:33:58 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1qH4Vv-0002jv-0s for pgsql-general@arkaria.postgresql.org; Wed, 05 Jul 2023 15:33:55 +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 1qH4Vt-0002jl-D1 for pgsql-general@lists.postgresql.org; Wed, 05 Jul 2023 15:33:54 +0000 Received: from mout-u-204.mailbox.org ([80.241.59.204]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qH4Vp-002Mvx-ND for pgsql-general@lists.postgresql.org; Wed, 05 Jul 2023 15:33:52 +0000 Received: from smtp102.mailbox.org (smtp102.mailbox.org [10.196.197.102]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-u-204.mailbox.org (Postfix) with ESMTPS id 4Qx3bY64J4z9sNs; Wed, 5 Jul 2023 17:33:45 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ewie.name; s=MBO0001; t=1688571225; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=BlSoi7nIB9ljfFtxEjpNrX/KlAQU3Mz3v5olvPunJyE=; b=Mdwmmqc0FikdUqyMOESsoFbtpj8FWbMkiZqXZN9U8BeACiXqPzfof2PT4VG1UHwqSsxf8P 2qGNRaV58Ey7ZNQtuyDqZox9B9nvyo0Twr5m7FjvXP7WHxEdpVlsRdxEc0pBCcDT6wpRJ3 rJgiRmSzEInFKZofcpn0+Gyylzo+IGRdlHtNiddociUn9h4VuvsE61NdIRIr1lf9cfeBU6 XUsOXYXR/G0P/RHo+k1zFB498Ryypdn5nZ1ANhRqKEBcVCYDgEgFD+PIkIwVJ51CAd+u7b t8jBxwOSlEdKWxbBn9KrMPPawjOtTE/EM+/v2+z9p6qKpdAZWmo8m4kmBmvRnw== Date: Wed, 5 Jul 2023 17:33:44 +0200 (CEST) From: Erik Wienhold To: Adrian Klaver , Lorusso Domenico , pgsql-general@lists.postgresql.org Message-ID: <2063713102.832030.1688571224669@office.mailbox.org> In-Reply-To: <84a4f250-e12f-9dd8-bf97-c794f6b909f5@aklaver.com> References: <84a4f250-e12f-9dd8-bf97-c794f6b909f5@aklaver.com> Subject: Re: Strange behaviour on function MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Priority: 3 Importance: Normal List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk > On 05/07/2023 17:16 CEST Adrian Klaver wrote: > > https://www.postgresql.org/docs/current/plpgsql-trigger.html > > 1) > "A trigger function must return either NULL or a record/row value having > exactly the structure of the table the trigger was fired for." > > 2) I am not seeing where you use: > > "TG_ARGV[] > > Data type array of text; the arguments from the CREATE TRIGGER > statement. The index counts from 0. Invalid indexes (less than 0 or > greater than or equal to tg_nargs) result in a null value." > > So I don't see how sqlstr is being set? Domenico did not provide the trigger definition, only function bind_action which he calls from a trigger function. Also bind_action cannot be a trigger function because it does not return trigger. -- Erik