public inbox for [email protected]  
help / color / mirror / Atom feed
Questions on Cursors in PostgreSQL
3+ messages / 2 participants
[nested] [flat]

* Questions on Cursors in PostgreSQL
@ 2017-06-27 17:07 Wei Shan <[email protected]>
  2017-06-27 17:53 ` Re: Questions on Cursors in PostgreSQL Dmitry Igrishin <[email protected]>
  0 siblings, 1 reply; 3+ messages in thread

From: Wei Shan @ 2017-06-27 17:07 UTC (permalink / raw)
  To: pgsql-interfaces

Hi all,

I have some questions on PostgreSQL cursors (not PL/pgSQL but the libpq
implementation):


   1. What happens when my cursor hit the end of the table? Does it close
   automatically? I suppose if I declare it as a SCROLLABLE cursor, it should
   not close at all.
   2. If I have declared a cursor and the session got disconnected, can I
   reattach back to the cursor if I know the cursor name? I believe this is
   not possible but I'm not very sure.

Thanks!

-- 
Regards,
Ang Wei Shan


^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Questions on Cursors in PostgreSQL
  2017-06-27 17:07 Questions on Cursors in PostgreSQL Wei Shan <[email protected]>
@ 2017-06-27 17:53 ` Dmitry Igrishin <[email protected]>
  2017-07-04 08:53   ` Re: Questions on Cursors in PostgreSQL Wei Shan <[email protected]>
  0 siblings, 1 reply; 3+ messages in thread

From: Dmitry Igrishin @ 2017-06-27 17:53 UTC (permalink / raw)
  To: Wei Shan <[email protected]>; +Cc: pgsql-interfaces

2017-06-27 20:07 GMT+03:00 Wei Shan <[email protected]>:

> Hi all,
>
> I have some questions on PostgreSQL cursors (not PL/pgSQL but the libpq
> implementation):
>
>
>    1. What happens when my cursor hit the end of the table? Does it close
>    automatically? I suppose if I declare it as a SCROLLABLE cursor, it should
>    not close at all.
>
> The lifetime of cursors created by the DECLARE ... SQL command longs until
the end of the session, or until it explicitly closed by either CLOSE ...
or DISCARD SQL commands.

>
>    1. If I have declared a cursor and the session got disconnected, can I
>    reattach back to the cursor if I know the cursor name? I believe this is
>    not possible but I'm not very sure.
>
> When session ends all cursors are deallocated automatically. You should
open the new cursor on reconnect.


^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Questions on Cursors in PostgreSQL
  2017-06-27 17:07 Questions on Cursors in PostgreSQL Wei Shan <[email protected]>
  2017-06-27 17:53 ` Re: Questions on Cursors in PostgreSQL Dmitry Igrishin <[email protected]>
@ 2017-07-04 08:53   ` Wei Shan <[email protected]>
  0 siblings, 0 replies; 3+ messages in thread

From: Wei Shan @ 2017-07-04 08:53 UTC (permalink / raw)
  To: Dmitry Igrishin <[email protected]>; +Cc: pgsql-interfaces

Thanks a lot!




On 27 Jun 2017 18:53, "Dmitry Igrishin" <[email protected]> wrote:



2017-06-27 20:07 GMT+03:00 Wei Shan <[email protected]>:

> Hi all,
>
> I have some questions on PostgreSQL cursors (not PL/pgSQL but the libpq
> implementation):
>
>
>    1. What happens when my cursor hit the end of the table? Does it close
>    automatically? I suppose if I declare it as a SCROLLABLE cursor, it should
>    not close at all.
>
> The lifetime of cursors created by the DECLARE ... SQL command longs until
the end of the session, or until it explicitly closed by either CLOSE ...
or DISCARD SQL commands.

>
>    1. If I have declared a cursor and the session got disconnected, can I
>    reattach back to the cursor if I know the cursor name? I believe this is
>    not possible but I'm not very sure.
>
> When session ends all cursors are deallocated automatically. You should
open the new cursor on reconnect.


^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2017-07-04 08:53 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2017-06-27 17:07 Questions on Cursors in PostgreSQL Wei Shan <[email protected]>
2017-06-27 17:53 ` Dmitry Igrishin <[email protected]>
2017-07-04 08:53   ` Wei Shan <[email protected]>

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox