Re: Is a syscache tuple more like an on-disk tuple or a freshly made one?
От | Alvaro Herrera |
---|---|
Тема | Re: Is a syscache tuple more like an on-disk tuple or a freshly made one? |
Дата | |
Msg-id | 20160415220301.GA469536@alvherre.pgsql обсуждение исходный текст |
Ответ на | Is a syscache tuple more like an on-disk tuple or a freshly made one? (Chapman Flack <chap@anastigmatix.net>) |
Ответы |
Re: Is a syscache tuple more like an on-disk tuple or a
freshly made one?
|
Список | pgsql-hackers |
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 be freshly made by > heap_form_tuple or some wrapper ..." 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. heap_form_tuple returns a newly palloc'd tuple, which is what you want. > ... and here I confess I'm unsure whether a tuple retrieved from > the syscache is more like an on-disk one, or a freshly-made one, > for purposes of the warning in that comment. A "syscache tuple" is definitely an on-disk tuple. -- Álvaro Herrera http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
В списке pgsql-hackers по дате отправления: