Re: useless RangeIOData->typiofunc

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
Cc: Pg Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: useless RangeIOData->typiofunc
Date: 2020-03-04 22:34:53
Message-ID: 8261.1583361293@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Alvaro Herrera <alvherre(at)2ndquadrant(dot)com> writes:
> I noticed while going over the multirange types patch that it adds a
> pointless typiofunc cached OID to a struct used for I/O functions'
> fn_extra. It seems to go completely unused, so I checked range types
> (which this was cribbed from) and indeed, it is completely unused there
> either. My guess is that it was in turn cribbed from array's
> ArrayMetaState, which is considerably more sophisticated; I suspect
> nobody noticed that caching it was pointless.

> Here's a patch to remove it from rangetypes.c. It doesn't really waste
> much memory anyway, but removing it lessens the cognitive load by one or
> two bits.

Hm, I'm not sure that really lessens the cognitive load any, but
if you do commit this please fix the dangling reference you left
in the nearby comment:

{
TypeCacheEntry *typcache; /* range type's typcache entry */
- Oid typiofunc; /* element type's I/O function */
Oid typioparam; /* element type's I/O parameter */
FmgrInfo proc; /* lookup result for typiofunc */
^^^^^^^^^^^^^^^^^^^^^^^^^^^
} RangeIOData;

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2020-03-04 23:15:28 Re: Allowing ALTER TYPE to change storage strategy
Previous Message Paul Jungwirth 2020-03-04 22:34:02 Re: useless RangeIOData->typiofunc