public inbox for [email protected]  
help / color / mirror / Atom feed
From: Adrian Klaver <[email protected]>
To: Ray O'Donnell <[email protected]>
To: pgsql-general <[email protected]>
Subject: Re: plpgsql: remove a field from a record?
Date: Sat, 27 Dec 2025 08:13:30 -0800
Message-ID: <[email protected]> (raw)
In-Reply-To: <0102019b608b1887-d8e9137f-46a7-4796-9f43-0addbab3c645-000000@eu-west-1.amazonses.com>
References: <0102019b608b1887-d8e9137f-46a7-4796-9f43-0addbab3c645-000000@eu-west-1.amazonses.com>

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.

> 
> Thanks in advance,
> 
> Ray.
> 


-- 
Adrian Klaver
[email protected]






view thread (3+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected]
  Subject: Re: plpgsql: remove a field from a record?
  In-Reply-To: <[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox