Re: Is a syscache tuple more like an on-disk tuple or a freshly made one? - Mailing list pgsql-hackers

From Chapman Flack
Subject Re: Is a syscache tuple more like an on-disk tuple or a freshly made one?
Date
Msg-id 57116E90.2090308@anastigmatix.net
Whole thread Raw
In response to Re: Is a syscache tuple more like an on-disk tuple or a freshly made one?  (Alvaro Herrera <alvherre@2ndquadrant.com>)
Responses Re: Is a syscache tuple more like an on-disk tuple or a freshly made one?  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On 04/15/16 18:03, Alvaro Herrera wrote:

> I suppose you could create a copy of the tuple (SysCacheSearchCopy) and
> use that for HeapTupleGetDatum.  The problem with the syscache tuple is
> that it can go away as soon as you do the ReleaseSysCache -- it lives in
> shared_buffers memory, so when it's released the buffer might get
> evicted.

Sure ... I wasn't going to call ReleaseSysCache until I was all done
with it anyway, should only take microseconds ... thought I'd be
clever and avoid making a copy, and pass it to existing code expecting
a Datum, but I guess that's more trouble than it's worth.

> A "syscache tuple" is definitely an on-disk tuple.

Got it. Thanks!

On 04/15/16 18:13, Tom Lane wrote:

> You could use heap_copy_tuple_as_datum().

Thanks, that looks like what the doctor ordered.

For pre-9.4, would the equivalent be basically
heap_form_tuple applied to the results of heap_deform_tuple ?

-Chap



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Is a syscache tuple more like an on-disk tuple or a freshly made one?
Next
From: Tom Lane
Date:
Subject: Re: Is a syscache tuple more like an on-disk tuple or a freshly made one?