Re: Protocol question regarding Portal vs Cursor

From: Dave Cramer <davecramer(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Protocol question regarding Portal vs Cursor
Date: 2023-11-08 11:02:56
Message-ID: CADK3HH+y-Ry1YPhT4SZUA08z0G1xQumAmQPBvRwF=MFrNnZp9A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Dave Cramer

On Tue, 7 Nov 2023 at 10:26, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:

> Dave Cramer <davecramer(at)gmail(dot)com> writes:
> > If we use a Portal it is possible to open the portal and do a describe
> and
> > then Fetch N records.
>
> > Using a Cursor we open the cursor. Is there a corresponding describe and
> a
> > way to fetch N records without getting the fields each time. Currently we
> > have to send the SQL "fetch <direction> N" and we get the fields and the
> > rows. This seems overly verbose.
>
> Portals and cursors are pretty much the same thing, so why not use
> the API that suits you better?
>

So in this case this is a refcursor. Based on above then I should be able
to do a describe on the refcursor and fetch using the extended query
protocol

Cool!

Dave

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tomas Vondra 2023-11-08 11:03:42 Re: Parallel CREATE INDEX for BRIN indexes
Previous Message Drouvot, Bertrand 2023-11-08 09:49:03 Re: Synchronizing slots from primary to standby