On 13-01-07 09:58 PM, Peter Eisentraut wrote:
> By implementing a "str" handler for the result object, it now prints
> something like
>
> <PLyResult status=5 nrows=2 rows=[{'foo': 1, 'bar': '11'}, {'foo': 2, 'bar': '22'}]>
>
> Patch attached for review.
>
Here is a review:
This patch adds a function that pl/python functions can call to convert
a query result hash into a string suitable for debug purposes. The use
case for this feature is primarily for debugging and logging purposes.
I feel that this is useful since a lot of debugging of stored functions
is usually done with print/elog style debugging.
There already some discussion on the thread as if the number of rows
printed should be limited, the consensus seemed to be 'no' since someone
would be unhappy with any limit and printing everything is the same
behaviour you get with the standard python print.
I've tested this with python2.6 and 3.1 and it seems to work as described.
I've looked through the code and everything looks fine.
The patch includes no documentation. Adding a few lines to the
"Utility Functions" section of the plpython documentation so people know
about this feature would be good.
Other than that I think it is fine to commit. I am setting this as
ready for committer, I assume you'll commit this yourself and that you
can add a paragraph to the docs as you commit it.
Steve
>
>