Re: [HACKERS] Is a syscache tuple more like an on-disk tuple or a freshly made one?

2016-04-15 Thread Tom Lane
Chapman Flack writes: > 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 ? You could do that, or you c

Re: [HACKERS] Is a syscache tuple more like an on-disk tuple or a freshly made one?

2016-04-15 Thread Chapman Flack
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 i

Re: [HACKERS] Is a syscache tuple more like an on-disk tuple or a freshly made one?

2016-04-15 Thread Tom Lane
Chapman Flack writes: > I am tempted to apply HeapTupleGetDatum to a tuple retrieved from > the syscache (as I already have code for processing a tuple presented > as a Datum). > But I see a comment on HeapTupleHeaderGetDatum: "This must *not* get > applied to an on-disk tuple; the tuple should b

Re: [HACKERS] Is a syscache tuple more like an on-disk tuple or a freshly made one?

2016-04-15 Thread Alvaro Herrera
Chapman Flack wrote: > I am tempted to apply HeapTupleGetDatum to a tuple retrieved from > the syscache (as I already have code for processing a tuple presented > as a Datum). > > But I see a comment on HeapTupleHeaderGetDatum: "This must *not* get > applied to an on-disk tuple; the tuple should

[HACKERS] Is a syscache tuple more like an on-disk tuple or a freshly made one?

2016-04-15 Thread Chapman Flack
Please bear with a neophyte question ... I am tempted to apply HeapTupleGetDatum to a tuple retrieved from the syscache (as I already have code for processing a tuple presented as a Datum). But I see a comment on HeapTupleHeaderGetDatum: "This must *not* get applied to an on-disk tuple; the tuple