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 1qViFR-0010jY-VI for pgsql-general@arkaria.postgresql.org; Tue, 15 Aug 2023 00:49:26 +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 1qViFQ-008dCF-IY for pgsql-general@arkaria.postgresql.org; Tue, 15 Aug 2023 00:49:24 +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 1qViFQ-008dC7-7c for pgsql-general@lists.postgresql.org; Tue, 15 Aug 2023 00:49:24 +0000 Received: from mail-pf1-x436.google.com ([2607:f8b0:4864:20::436]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1qViFJ-000AcP-MU for pgsql-general@lists.postgresql.org; Tue, 15 Aug 2023 00:49:23 +0000 Received: by mail-pf1-x436.google.com with SMTP id d2e1a72fcca58-686f0d66652so4692651b3a.2 for ; Mon, 14 Aug 2023 17:49:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1692060556; x=1692665356; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=7vWv0ixIzSf+w9RYYnlWMqaORRKTqPiJFwzzdENRsK8=; b=UOVwKNmFT/SJnziZ3Xh+x+f5dmsbd/pzBi2ImBsNX7w0VUDVTnhK3ltB2fSCmcM1z+ hZL7Z0xz5G9quzD5dBwKMiWwfYDdr1ZacC4QcRuip8rrk6O5AoD+iiTWCmeGh46UeJBP q/UNToCYqWv+MZJHjHYsgu2oT7gDtsw7YeS9pB5B0gDpHe9tINSO+nRpiqutMf0VVILR rEDUyx1/tp7ZnAT9q4ZZ4li4QrMcn5SM2JxCByGyZhqkDBPEbMowMV49xBtLw/PZ5He4 lmPtlGO6HRZF/UtxiMRCjKcYIhui3A56Wh7w9J729vzjDoq2Kn5hhIUhNRnWTORgEhg4 MmVA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692060556; x=1692665356; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=7vWv0ixIzSf+w9RYYnlWMqaORRKTqPiJFwzzdENRsK8=; b=Y3PHHi+EtytccMZRmSnFt0Ykym2pFD8wRwoAF6PyczBdrQA7kv1vHyH2PViuti6YsR JncZDT9gylddEG9/IrRErxuCk6Mje6TtV4jYY2X8wmDwNRKxQVvmCQ91SPD0XjxPiz+U vVIyoTRnEegRM7vJokzRyoX2RHZ2D1gqP4MGsfhnn11JGTHstzEqZPTtzyPAZZxs/H6Z C4ZDey1Auqy3q+6x+rf6ohu7m98X3qCBPEEji78qOzHzp3BJV1DMRywFuqE6vuhH7QP0 B4SSoGMOTrrUoIDu5/QWgMDvb/JNVijqhuWOyTScueDwmUsZN1sq7ZFeKYlXKPbEgdAo c3Cw== X-Gm-Message-State: AOJu0Yz/mDuwqPYWvHd1jyAa6Wdzhb2uoZ1oxy71eYlAuABggDOw4C79 m4gOzb6NOd/JqnhR/qQEdO2bT75nlOQ= X-Google-Smtp-Source: AGHT+IGFM5Se3GNwb/T6jFWNMXM5PInhtLC4JgaaYhZTp6ZyPrAgZksQZclKi49MVig/R76rvsQIog== X-Received: by 2002:a05:6a20:325a:b0:138:48d7:4a31 with SMTP id hm26-20020a056a20325a00b0013848d74a31mr12417961pzc.62.1692060555607; Mon, 14 Aug 2023 17:49:15 -0700 (PDT) Received: from ?IPV6:2601:681:5a00:f790:3304:ead1:413c:3a13? ([2601:681:5a00:f790:3304:ead1:413c:3a13]) by smtp.gmail.com with ESMTPSA id l6-20020a62be06000000b0066f37665a63sm8472199pff.73.2023.08.14.17.49.14 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 14 Aug 2023 17:49:15 -0700 (PDT) Message-ID: <4c1e0917-4ee8-6a10-f06b-dae47bd05ae7@gmail.com> Date: Mon, 14 Aug 2023 18:49:14 -0600 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Subject: Re: Dynamically accessing columns from a row type in a trigger Content-Language: en-CA To: pgsql-general@lists.postgresql.org References: <068f5479-5b58-6084-1141-fd320b722782@aklaver.com> From: Rob Sargent In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk So the less obvious solution that works is to create a temporary > table. A little verbose, but I get to keep the types. > > `CREATE TEMPORARY TABLE _ ON COMMIT DROP AS SELECT OLD.*;` > > _ as a table name makes things a little easier to type. > > > > Rhys > Peace & Love | Live Long & Prosper > > If the connection creating the table is long-lived, maybe make the table once and truncate instead.