Search Postgresql Archives

Re: Prepared statements and cursors

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Jan 23, 2014 at 8:31 AM, Andreas Lubensky <lubensky@xxxxxxxxxxxx> wrote:
> Hello,
> When implementing a database backend with libpq I realized that it seems
> to be impossible to declare a cursor on a prepared statement. Is this
> correct? What is the reason for this limitation?

I can't think of any but it can be trivially worked around:
create or replace function f() returns void as $$ declare v cursor for
select 0; $$ language sql;
prepare p as select f();
postgres=# begin;
BEGIN
postgres=# execute p;
 f
---

(1 row)

postgres=# fetch all from v;
 ?column?
----------
        0

merlin


-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux