Re: Large writable variables

From: Andres Freund <andres(at)anarazel(dot)de>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Large writable variables
Date: 2018-10-16 04:12:40
Message-ID: 20181016041240.hhwbip74kge6ybcm@alap3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On 2018-10-15 16:45:03 -0700, Andres Freund wrote:
> I've a patch making .data variables constant, fwiw. Will post in a
> bit. Just so we don't duplicate work too much.

I pushed a few very obvious ones.

An additional fix, for the system attributes in heap.c, is attached. But
that's a bit more invasive, so I wanted to get some input.

I think all of the changes are fairly obvious and the new const
attributes just document what already had to be the case. But to
correctly propagate the const through typedef-the-pointer-away typedefs,
I had to use the underlying type (e.g. use const NameData *n2 instad of
Name n2). To me that's the correct fix, but then I hate these typedefs
with a passion anyway. An alternative fix is to add additional
typedefs like ConstName, but I don't find that particularly
advantageous.

Comments?

Arguably we should use consts more aggresively in signatures anyway, but
I think that's a separate effort.

Greetings,

Andres Freund

Attachment Content-Type Size
0001-Correct-constness-of-system-attributes-in-heap.c-pre.patch text/x-diff 11.0 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Ashutosh Sharma 2018-10-16 04:33:55 Re: Multi-insert into a partitioned table with before insert row trigger causes server crash on latest HEAD
Previous Message Amit Kapila 2018-10-16 03:48:49 Re: WIP: Avoid creation of the free space map for small tables