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: what makes the PL cursor life-cycle must be in the same transaction?
Date: 2019-03-10 08:14:16
Message-ID: CAKU4AWqKLRVNG8aTF7AXqbxXEiLFYJ4UY4z1iCAWAp=RezY6zA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message David Rowley 2019-03-10 08:34:51 Re: Performance issue in foreign-key-aware join estimation
Previous Message Fabien COELHO 2019-03-10 07:15:35 Re: Patch to document base64 encoding