| From: | Ray O'Donnell <ray(at)rodonnell(dot)ie> |
|---|---|
| To: | Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>, pgsql-general <pgsql-general(at)postgresql(dot)org> |
| Subject: | Re: plpgsql: remove a field from a record? |
| Date: | 2025-12-27 16:14:52 |
| Message-ID: | 0102019b60976195-55ebd253-f526-4655-9096-3817796b6803-000000@eu-west-1.amazonses.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
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(at)rodonnell(dot)ie
| From | Date | Subject | |
|---|---|---|---|
| Next Message | H | 2025-12-29 01:38:50 | Combining metavariables and table names |
| Previous Message | Pavel Stehule | 2025-12-27 16:14:04 | Re: plpgsql: remove a field from a record? |