Re: Prepared statements and cursors
| От | Merlin Moncure |
|---|---|
| Тема | Re: Prepared statements and cursors |
| Дата | |
| Msg-id | CAHyXU0xa9zbGmtOj+CtLmCf1awDCEF6fk_70Laz2e-uyuqf9hA@mail.gmail.com обсуждение исходный текст |
| Ответ на | Prepared statements and cursors (Andreas Lubensky <lubensky@cognitec.com>) |
| Ответы |
Re: Prepared statements and cursors
|
| Список | pgsql-general |
On Thu, Jan 23, 2014 at 8:31 AM, Andreas Lubensky <lubensky@cognitec.com> 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
В списке pgsql-general по дате отправления: