Re: hi, is it dangerous to only use tuple pointer through heap_getnext()?

From: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
To: sunpeng <bluevaley(at)gmail(dot)com>
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: hi, is it dangerous to only use tuple pointer through heap_getnext()?
Date: 2010-05-15 01:15:34
Message-ID: 1273886083-sup-6446@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Excerpts from sunpeng's message of vie may 14 19:15:47 -0400 2010:
> hi,i use these codes to store only pointer of tuple :
> HeapTuple *tuple;
> tuple = heap_getnext(pHeapScanDesc,ForwardScanDirection);
> while(tuple){
> //[1#]here i only store the pointer of tuple in an array for later
> using,that means i don't retrive attribute data from this tuple ,is this ok?

No, this is not safe. The buffer is unpinned after heap_getnext walks
to the next buffer, and thus could be used for a different page.

--

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Craig Ringer 2010-05-15 01:43:13 Re: psql feature request (\dd+)
Previous Message sunpeng 2010-05-14 23:15:47 hi,is it dangerous to only use tuple pointer through heap_getnext()?