Re: PL/Python result object str handler

Поиск
Список
Период
Сортировка
От Steve Singer
Тема Re: PL/Python result object str handler
Дата
Msg-id BLU0-SMTP11B267EDD511C645F7F56EDC030@phx.gbl
обсуждение исходный текст
Ответ на PL/Python result object str handler  (Peter Eisentraut <peter_e@gmx.net>)
Ответы Re: PL/Python result object str handler  (Peter Eisentraut <peter_e@gmx.net>)
Список pgsql-hackers
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



>
>




В списке pgsql-hackers по дате отправления:

Предыдущее
От: Pavel Stehule
Дата:
Сообщение: Re: proposal - assign result of query to psql variable
Следующее
От: Jeff Janes
Дата:
Сообщение: Re: Setting visibility map in VACUUM's second phase