Re: [HACKERS] libpq: why we need to fetch all rows? - Mailing list pgsql-hackers

From Bruce Momjian
Subject Re: [HACKERS] libpq: why we need to fetch all rows?
Date
Msg-id f9d805750ae26f93856b40f2c6a907fe
Whole thread Raw
In response to [HACKERS] libpq: why we need to fetch all rows?  (Alexander Demenshin <aldem@techie.com>)
List pgsql-hackers
>
> On Sun, Jun 29, 1997 at 01:44:36PM -0400, Bruce Momjian wrote:
>
> > Because it is not standard SQL.  No database I know of returns multiple
> > rows with out a 'declare' statement and a cursor.

Actually, standard SQL requires a cursor so you can name the cursor to
fetch from, but PostgreSQL requires it to be in a transaction, which is
not standard.

>
>   Not so good... But then, why not to modify backend and libpq
>   in a way, which will allow to fetch rows one-by-one?

OK, can you run a test?  If you start a transaction, declare a cursor,
and do a fetch over and over again, does it return one line at a time
from the server.  I think it does.

Now, it will not return from the first fetch until the query has
finished executing, but I don't think it will send all the results to
the client, only one at a time.

- --
Bruce Momjian
maillist@candle.pha.pa.us

------------------------------

pgsql-hackers by date:

Previous
From: "Michael J. Miller Jr."
Date:
Subject: Re: [HACKERS] libpq: why we need to fetch all rows?
Next
From: Bruce Momjian
Date:
Subject: Re: [HACKERS] libpq: why we need to fetch all rows?