Re: Reset the cursor to start from the record 1

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Igor Korot <ikorot01(at)gmail(dot)com>
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Reset the cursor to start from the record 1
Date: 2018-06-05 21:45:53
Message-ID: CAKFQuwZA538ys0_xNo9z=YrfJm5Z36oN6bzEhESc0csDegjaUg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, Jun 5, 2018 at 2:08 PM, Igor Korot <ikorot01(at)gmail(dot)com> wrote:

> Is there a function which just reset the record pointer to 1, so I can
> reprocess
> those records
> ​?
>

​While I haven't actually programmed using this API...

The documentation doesn't seem to indicate the presence of a "record
pointer", it shows that PQgetvalue accepts both row and column numbers as
input, and it indicates the PGResult stays in memory - and contains the
entire result - until PQclear'ed. This leads me to think that you should
be able to access values in any cell at any time, including multiple times,
without issue. Have you tried it?

Now, if you are using Row-by-Row mode that likely varies a bit: but your
example doesn't show that to be the case.

​David J.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Jerry Sievers 2018-06-05 21:53:31 Which backend using which pg_temp_N schema?
Previous Message Ozz Nixon 2018-06-05 21:34:39 RE: Code of Conduct plan