Re: why declare arg as a array in FunctionCallInfoData structure

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Tao Ma <feng_eden(at)163(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: why declare arg as a array in FunctionCallInfoData structure
Date: 2009-02-02 08:39:25
Message-ID: 162867790902020039x711f55fbyc665334c885115ae@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

2009/2/2 Tao Ma <feng_eden(at)163(dot)com>:
> hi,
>
> When I read the postgresql codes, I noticed that the FunctionCallInfoData
> structure(declared in the src/include/fmgr.h) contains two arrays 'arg' and
> 'argnull'.
> Why don't you declare it as a pointer and allocate the memory from heap? It
> saves more momery if 'arg' and 'argnull' declares as pointer type.
>
> Can anyone explain it to me?
>

It based on Datum data type, that store short fixed values directly
(int, float), and you need second array, that carries info about NULL
or NOT NULL. Bigger problem is some non consistency - sometime this is
bool array, and sometime array of char.

Regards
Pavel Stehule

> Thanks in advance.
>
>
>
> --
> Sent via pgsql-hackers mailing list (pgsql-hackers(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-hackers
>

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Simon Riggs 2009-02-02 10:45:33 Re: Controlling hot standby
Previous Message Martijn van Oosterhout 2009-02-02 08:33:39 Re: why declare arg as a array in FunctionCallInfoData structure