Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.92) (envelope-from ) id 1j9Box-00046o-5s for pgsql-general@arkaria.postgresql.org; Tue, 03 Mar 2020 17:59:07 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1j9Bov-0005hI-4Z for pgsql-general@arkaria.postgresql.org; Tue, 03 Mar 2020 17:59:05 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1j9Bou-0005hB-Rm for pgsql-general@lists.postgresql.org; Tue, 03 Mar 2020 17:59:04 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1j9Bos-0003tK-M5 for pgsql-general@lists.postgresql.org; Tue, 03 Mar 2020 17:59:04 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id 023Hx0NO006107; Tue, 3 Mar 2020 12:59:00 -0500 From: Tom Lane To: stan cc: pgsql-general@lists.postgresql.org Subject: Re: Examing cotets of NEW & OLD in a function programed in perl In-reply-to: <20200303173901.GA5019@panix.com> References: <20200303173901.GA5019@panix.com> Comments: In-reply-to stan message dated "Tue, 03 Mar 2020 12:39:01 -0500" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <6105.1583258340.1@sss.pgh.pa.us> Date: Tue, 03 Mar 2020 12:59:00 -0500 Message-ID: <6106.1583258340@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk stan writes: > I need to write a generic function to process data before allowing the > insert or update to continue. > To do this, I need to be able to examine the NEW, and OLD structures > without prior knowledge of the structure of the table that fired the > trigger. AFAIR, they're just hashes in Perl, so you should be able to do stuff like iterating over the hash keys. regards, tom lane