Re: fast defaults in heap_getattr vs heap_deform_tuple

From: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: Andrew Dunstan <andrew(dot)dunstan(at)2ndquadrant(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: fast defaults in heap_getattr vs heap_deform_tuple
Date: 2019-02-06 01:44:38
Message-ID: 20190206014438.GA3755@alvherre.pgsql
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2019-Feb-05, Andres Freund wrote:

> @@ -82,7 +80,7 @@ static Datum getmissingattr(TupleDesc tupleDesc, int attnum, bool *isnull);
> /*
> * Return the missing value of an attribute, or NULL if there isn't one.
> */
> -static Datum
> +Datum
> getmissingattr(TupleDesc tupleDesc,
> int attnum, bool *isnull)

This is a terrible name for an exported function -- let's change it
before it gets exported. Heck, even heap_getmissingattr() would be
better.

I notice that with this patch, heap_getattr() obtains a new Assert()
that the attr being fetched is no further than tupledesc->natts.
It previously just returned null for that case. Maybe we should change
it so that it returns null if an attr beyond end-of-array is fetched?
(I think in non-assert builds, it would dereference past the AttrMissing
array.)

--
Álvaro Herrera https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2019-02-06 01:53:37 Re: Don't deform column-by-column in composite_to_json
Previous Message Alvaro Herrera 2019-02-06 01:35:12 Re: Refactoring IndexPath representation of index conditions