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.96) (envelope-from ) id 1vZWxW-00Dqi8-1Q for pgsql-general@arkaria.postgresql.org; Sat, 27 Dec 2025 16:16:03 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vZWxV-00C2ZU-1R for pgsql-general@arkaria.postgresql.org; Sat, 27 Dec 2025 16:16:02 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from <0102019b60976195-55ebd253-f526-4655-9096-3817796b6803-000000@mail.rodonnell.ie>) id 1vZWwQ-00ByYo-1T for pgsql-general@lists.postgresql.org; Sat, 27 Dec 2025 16:14:55 +0000 Received: from a7-34.smtp-out.eu-west-1.amazonses.com ([54.240.7.34]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from <0102019b60976195-55ebd253-f526-4655-9096-3817796b6803-000000@mail.rodonnell.ie>) id 1vZWwP-0036eW-04 for pgsql-general@postgresql.org; Sat, 27 Dec 2025 16:14:54 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=pttss7zjfbrazujxl6mrlo4sg34ocala; d=rodonnell.ie; t=1766852092; h=Message-ID:Date:MIME-Version:Subject:To:References:From:In-Reply-To:Content-Type:Content-Transfer-Encoding; bh=WgP94SEEnGM+oy8w1MK/vVasnIaB1c4kExE79zonmE0=; b=kDjZSQnUeoH7nmezYbkaIdU2q8Di4d0zAVtvXSGnuJM++W6loNYEWlqqhqBONiPx a5UABSWhsVrAVuOucyEKiYOt1pVuN2V+cUQ3ZqG+lzXM9794y/zR7aDWZqDOReYcub7 I3y8lZz48+0EsN7MSqLbiA/dgQHMlGp17HGJY/Mpbwsat0SP+0zcerD+V6w2g2QbrOR Eqtw9epSbS+Hfbl+V9Y/wmeljLS5VLjJuE4Dw7y7POD37b7kFp3EDi/fy4NHwmuUVr/ QuPiqSRlCm11JiTShAwDQXuzsfrWY46bNgsyB3qkzhnFPrThjFVEnaHV457Sxgi+PpX uNfjbQ9+hA== DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=ihchhvubuqgjsxyuhssfvqohv7z3u4hn; d=amazonses.com; t=1766852092; h=Message-ID:Date:MIME-Version:Subject:To:References:From:In-Reply-To:Content-Type:Content-Transfer-Encoding:Feedback-ID; bh=WgP94SEEnGM+oy8w1MK/vVasnIaB1c4kExE79zonmE0=; b=j3tnaH8tY2ywjf4nPbKHSvsTLN3K+28Fcckmt5hAA8dQdHdu26M1gUtxFHgPHBOv aax4YTk9qjnPiYpAv85JmRGH7ljpcL5mLgbfPrnksc04XjYqltmNYqzY7WYLqyUVpOv G+ojnBmr8RJ1A6QmRHKS33CpCDcuXWjkCR8pcxos= Message-ID: <0102019b60976195-55ebd253-f526-4655-9096-3817796b6803-000000@eu-west-1.amazonses.com> Date: Sat, 27 Dec 2025 16:14:52 +0000 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: plpgsql: remove a field from a record? To: Adrian Klaver , pgsql-general References: <0102019b608b1887-d8e9137f-46a7-4796-9f43-0addbab3c645-000000@eu-west-1.amazonses.com> Content-Language: en-GB From: Ray O'Donnell In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Feedback-ID: ::1.eu-west-1.Bw1eu/7Uepg3xcsiFBL71JJRCh2A2yTFrgBhhiulXmU=:AmazonSES X-SES-Outgoing: 2025.12.27-54.240.7.34 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 27/12/2025 16:13, Adrian Klaver wrote: > On 12/27/25 08:01, Ray O'Donnell wrote: >> Hi all, >> >> In a plpgsql function, is it possible to remove a field from a RECORD >> value? >> >> My specific use-case is that I have a row returned from a MERGE >> operation into a variable, declared as type RECORD, which will then >> be logged; and I want to remove some potentially sensitive stuff from >> it before it gets logged. >> >> I could manually redact the sensitive items (e.g. set them to null); >> but it'd be tidier just to remove them altogether if I can. > > A record 'type' supports record_name.field_name notation. Not sure how > many fields you want to log, but you could log only the non-sensitive > fields explicitly e.g. record_name.fld1, record_name.fld3, > record_name.fld4, etc. Aargh - I was being silly - of course I can return only the items I want to log from the MERGE. Thanks Adrian, and apologies for the noise! Ray. > >> >> Thanks in advance, >> >> Ray. >> > > -- Ray O'Donnell // Galway // Ireland ray@rodonnell.ie