Re: undersized unions

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Michael Paquier <michael(at)paquier(dot)xyz>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: undersized unions
Date: 2023-02-06 18:51:33
Message-ID: CA+TgmobwLf7BewSx=mb8+-VYiadvz2C4Xu4VDzCSyxwqP1Z9VQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Feb 6, 2023 at 1:28 PM Andres Freund <andres(at)anarazel(dot)de> wrote:
> Perhaps something like

Yeah, that'd work. You'd want a big ol' warning comment here:

> typedef struct NumericData
> {
> int32 vl_len_; /* varlena header (do not touch directly!) */
> NumericBase data;
> } NumericData;

like /* actually NumericShort or NumericLong */ or something

> Although I'd actually be tempted to rip out all the casts but NUMERIC_LONG()
> in this case, because it's all all just accessing the base n_header anyway.

Yeah.

--
Robert Haas
EDB: http://www.enterprisedb.com

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2023-02-06 19:07:39 Re: Non-superuser subscription owners
Previous Message Tomas Vondra 2023-02-06 18:51:19 Re: lockup in parallel hash join on dikkop (freebsd 14.0-current)