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 1q6ska-00018e-VR for pgsql-general@arkaria.postgresql.org; Wed, 07 Jun 2023 12:58:57 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1q6skZ-0005sd-Iz for pgsql-general@arkaria.postgresql.org; Wed, 07 Jun 2023 12:58: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 1q6skZ-0005sU-63 for pgsql-general@lists.postgresql.org; Wed, 07 Jun 2023 12:58:55 +0000 Received: from lana.depesz.com ([88.198.49.178] helo=depesz.com) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1q6skU-000n1e-NY for pgsql-general@lists.postgresql.org; Wed, 07 Jun 2023 12:58:54 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=depesz.com; s=20170201; h=In-Reply-To:Content-Type:MIME-Version:References:Reply-To: Message-ID:Subject:Cc:To:Sender:From:Date:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=hxMDnnu0cDVtHGrqH6dOZvTbL4shW8f8HjEcakkNdnE=; b=rojB56dzwPj6uztJzDtXnDo16J WcagEf++dEBqGrZ8S9zJcCgGDnFIXmlD1SN5FZuPP550YX0ehec2wCYwz0Z1TUKjXrFge9EazUaHq 3xG3BqTu4I7nA2Lo0TcDy+XAKl8tEEP2pLjjLnvN3Z4oiuYz9EGPq7Ueudogw9POxm8g=; Received: from depesz by depesz.com with local (Exim 4.94.2) (envelope-from ) id 1q6skT-004oeY-87; Wed, 07 Jun 2023 14:58:49 +0200 Date: Wed, 7 Jun 2023 14:58:49 +0200 From: hubert depesz lubaczewski Sender: depesz@depesz.com To: Lorusso Domenico Cc: pgsql-general@lists.postgresql.org Subject: Re: How to manipulate field in New record Message-ID: Reply-To: depesz@depesz.com References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Wed, Jun 07, 2023 at 02:12:58PM +0200, Lorusso Domenico wrote: > Hello, > Looking for a global solution I've write e trigger function that as > optional parameter (argv[0]) receive the name of a specific parameter. > > My need is to get the filed from NEW and OLD record manipulate and set back > the field with new value. > > Problem 1: how to get and set this field > Problem 2: the field has Composit type Do this in pl/perl, pl/python, pl/tcl or anything like this. Or use one of methods shown here: https://www.depesz.com/2021/04/21/getting-value-from-dynamic-column-in-pl-pgsql-triggers/ depesz