pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Rashid Abzalov <rashid.abzalov@gmail.com>
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: The statement is re-executed (performed twice) on commit if it is declared as "cursor with hold" and the cursor is not closed yet
Date: Fri, 12 Jul 2019 16:33:10 -0400
Message-ID: <5894.1562963590@sss.pgh.pa.us> (raw)
In-Reply-To: <CACrSCdEquRApzys++BED0=486rhAtrKnWrf4Y9mc2nhsGVUmrQ@mail.gmail.com>
References: <CACrSCdEquRApzys++BED0=486rhAtrKnWrf4Y9mc2nhsGVUmrQ@mail.gmail.com>

Rashid Abzalov <rashid.abzalov@gmail.com> writes:
> The statement is re-executed on commit if it is declared as "cursor with
> hold" and the cursor is not closed yet.

That is not a bug, it's how cursors with hold work.

(Volatile functions in cursors are a pretty fraught issue all around.
I do not think we make very many guarantees about how often they'll
be executed, if you do any re-reading or re-positioning of the cursor.)

			regards, tom lane





view thread (4+ messages)  latest in thread

Message-ID: <5894.1562963590@sss.pgh.pa.us>
Permalink:  ../5894.1562963590@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/5894.1562963590@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, rashid.abzalov@gmail.com
  Subject: Re: The statement is re-executed (performed twice) on commit if it is declared as "cursor with hold" and the cursor is not closed yet
  In-Reply-To: <5894.1562963590@sss.pgh.pa.us>
  References: <CACrSCdEquRApzys++BED0=486rhAtrKnWrf4Y9mc2nhsGVUmrQ@mail.gmail.com> <5894.1562963590@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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