From: SourceForge.net <no...@so...> - 2008-03-24 22:00:35
|
Bugs item #1924687, was opened at 2008-03-24 22:00 Message generated for change (Tracker Item Submitted) made by Item Submitter You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=116528&aid=1924687&group_id=16528 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: PgConnection Group: None Status: Open Resolution: None Priority: 5 Private: No Submitted By: Robert Brewer (aminusfu) Assigned to: Nobody/Anonymous (nobody) Summary: callproc result set not retrievable Initial Comment: The Cursor.callproc method in pyPgSQL (at least up to version 1.5) has two problems. First, it takes *args instead of a single args parameter, which is contrary to the DBAPI spec and most other implementations of it. Second, it calls 'select proc(args)', which does not allow fetchall() to retrieve its return value. Therefore, this patches pyPgSQL.Cursor.callproc to take a single args param, and to execute 'select * from proc(args)', which allows fetchall() to work properly. It'd be nice if a future version of pyPgSQL used the "*" form of the call. from pyPgSQL import PgSQL as pgsql if not hasattr(pgsql.Cursor, "_old_callproc"): def callproc2(self, proc, args): """ Call a stored procedure with a fetchable return value. Note that this takes a single args attribute instead of *args. """ return self._old_callproc(" * from " + proc, *args) pgsql.Cursor._old_callproc = pgsql.Cursor.callproc pgsql.Cursor.callproc = callproc2 ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=116528&aid=1924687&group_id=16528 |