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 1nojai-0008SU-SI for pgsql-general@arkaria.postgresql.org; Wed, 11 May 2022 10:29:13 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1nojag-0000CU-TQ for pgsql-general@arkaria.postgresql.org; Wed, 11 May 2022 10:29:10 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nojag-0000B0-GK for pgsql-general@lists.postgresql.org; Wed, 11 May 2022 10:29:10 +0000 Received: from lana.depesz.com ([88.198.49.178] helo=depesz.com) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nojad-00014t-4x for pgsql-general@postgresql.org; Wed, 11 May 2022 10:29:09 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=depesz.com; s=20170201; h=In-Reply-To:Content-Transfer-Encoding:Content-Type: MIME-Version:References:Reply-To:Message-ID:Subject:Cc:To:Sender:From:Date: 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=zQGr+kwYvIpAi5/7j/mH+5ZpZy2bgCLgLEJ9AGhB3JE=; b=T0gSDhD0ZJGAtvBViG7xrA4LO8 ZEhFssY9Fke4zOS2jWZX8DZEHfC+dXktYDvDbXHs7tnr9WW04eSWq5PtDPqgacPuUhN6ckwIr15Wi is9XOpd60YiDCQbFQJ6h48Wj0aHS+76P8Jt/jjy0BXFcz8ytjvypn5ABnbrPQ1rRMpZc=; Received: from lana.depesz.com ([88.198.49.178] helo=depesz.com) by depesz.com with esmtpa (Exim 4.92) (envelope-from ) id 1nojaa-0005sg-4P; Wed, 11 May 2022 12:29:04 +0200 Date: Wed, 11 May 2022 12:29:04 +0200 From: hubert depesz lubaczewski Sender: depesz@depesz.com To: "David G. Johnston" Cc: Durumdara , Postgres General Subject: Re: PLPGSQL - extra column existence in trigger Message-ID: <20220511102903.GA4161@depesz.com> Reply-To: depesz@depesz.com References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Sat, May 07, 2022 at 07:41:44AM -0700, David G. Johnston wrote: > No. I’d probably approach this by generically converting the NEW record to > json and working with that. Non-existent object keys return null when > accessed. One note - in my tests working with hstore was significantly faster than json. It could have changed since I wrote it, but you might want to check it out: https://www.depesz.com/2021/04/21/getting-value-from-dynamic-column-in-pl-pgsql-triggers/ depesz