creating WITH HOLD cursors using SPI

From: Abhijit Menon-Sen <ams(at)oryx(dot)com>
To: plperlng-devel(at)pgfoundry(dot)org
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: creating WITH HOLD cursors using SPI
Date: 2005-06-12 09:24:47
Message-ID: 20050612092447.GA27994@penne.toroid.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi.

I've been working on making it possible for PL/Perl users to fetch large
result sets one row at a time (the current spi_exec_query interface just
returns a big hash).

The idea is to have spi_query call SPI_prepare/SPI_open_cursor, and have
an spi_fetchrow that calls SPI_cursor_fetch. It works well enough, but I
don't know how to reproduce spi_exec_query's error handling (it runs the
SPI_execute in a subtransaction).

To do something similar, I would have to create a WITH HOLD cursor in my
spi_query function. But SPI_cursor_open provides no way to do this, and
it calls PortalStart before I can set CURSOR_OPT_HOLD myself.

Suggestions?

-- ams

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Yann Michel 2005-06-12 10:46:14 Re: User/Group Quotas Revisited
Previous Message Gregory Maxwell 2005-06-12 01:45:12 Re: User/Group Quotas Revisited