Re: BUG #14465: cursor for insert into select ... returning cann't streaming fetch?

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: "digoal(at)126(dot)com" <digoal(at)126(dot)com>
Cc: "pgsql-bugs(at)postgresql(dot)org" <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: BUG #14465: cursor for insert into select ... returning cann't streaming fetch?
Date: 2016-12-14 03:57:00
Message-ID: CAKFQuwaRoOGEYQAwP9nxCSaCeLb5uJ1-OuH5GEoGPf=ayzeoBA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Tuesday, December 13, 2016, <digoal(at)126(dot)com> wrote:

> The following bug has been logged on the website:
>
> Bug reference: 14465
> Logged by: Zhou Digoal
> Email address: digoal(at)126(dot)com <javascript:;>
> PostgreSQL version: 9.6.1
> Operating system: CentOS 6.x x64
> Description:
>
> HI,
> when i write a plpgsql return refcursor.
> the refcursor is a ```insert into .. select .. from .. returning *;```
> query.
> but when i use auto_explain DEBUG it, i found the fetch after insert
> end,
> not stream , insert and fetch the same time coordinat.
> can PostgreSQL improve it?
>
>
This isn't a bug.

Opening a cursor causes it to execute, which in this case means performing
the insert. You can only return opened cursors from a function. The act
of fetching from the cursor simply gives access to the underlying rows.

Not sure what improvement you are wanting here but a posting to -general
would be more appropriate. Describing your use case would help others
understand why this might be useful.

David J.

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Kaijiang Chen 2016-12-14 05:00:53 Re: pg_dump's results have quite different size
Previous Message digoal 2016-12-14 02:56:53 BUG #14465: cursor for insert into select ... returning cann't streaming fetch?