From: | "John Hansen" <john(at)geeknet(dot)com(dot)au> |
---|---|
To: | "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | "Pgsql Hackers" <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: PG_FREE_IF_COPY() |
Date: | 2005-06-14 14:30:02 |
Message-ID: | 5066E5A966339E42AA04BA10BA706AE50A9341@rodrick.geeknet.com.au |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Tom Lane [mailto:tgl(at)sss(dot)pgh(dot)pa(dot)us] wrote:
> "John Hansen" <john(at)geeknet(dot)com(dot)au> writes:
> > Given the following snippet:
> > HeapTupleHeader tuple;
> > Datum temp;
> > bool isnull;
>
> > tuple = PG_GETARG_HEAPTUPLEHEADER(0);
> > temp = GetAttributeByName(tuple, "data", &isnull);
>
> > When using this for a btree operator functions, you need to
> > PG_FREE_IF_COPY(?,?);
>
> > Which of the above parameters need I free?
>
> It'd probably be wise to do a FREE_IF_COPY on the tuple.
>
> GetAttributeByName, however, hasn't copied anything (if it's
> a pass-by-ref type you'll just get a pointer into the tuple).
> If you do a copy further down that might be a reason to free
> something, but this code alone isn't making a copy.
Cool, thanks...
>
> regards, tom lane
>
>
... John
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2005-06-14 14:31:03 | Re: Gist Recovery testing |
Previous Message | Tom Lane | 2005-06-14 14:27:21 | Re: PG_FREE_IF_COPY() |