Re: what makes the PL cursor life-cycle must be in the same transaction?

From: Andy Fan <zhihui(dot)fan1213(at)gmail(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: what makes the PL cursor life-cycle must be in the same transaction?
Date: 2019-03-11 00:54:58
Message-ID: CAKU4AWq88RjVc68VV5MvynPhT7j9OkkPVmSKw+OfdUbA_HQHLA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

DECLARE cur CURSOR with hold FOR SELECT * FROM t;

the "with hold" is designed for this purpose. sorry for this
interruption.

On Sun, Mar 10, 2019 at 4:14 PM Andy Fan <zhihui(dot)fan1213(at)gmail(dot)com> wrote:

> for example:
> begin;
> declare cur cursor for select * from t;
> insert into t2 values(...);
> fetch next cur;
> commit;
>
> // after this, I can't fetch cur any more.
>
> My question are:
> 1. Is this must in principle? or it is easy to implement as this in PG?
> 2. Any bad thing would happen if I keep the named portal (for the cursor)
> available even the transaction is commit, so that I can fetch the cursor
> after the transaction is committed?
>
> Thanks
>

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Imai, Yoshikazu 2019-03-11 01:10:11 RE: speeding up planning with partitions
Previous Message Michael Paquier 2019-03-11 00:40:12 Re: pgsql: Removed unused variable, openLogOff.