Weird PL/Python elog output

Поиск
Список
Период
Сортировка
От Peter Eisentraut
Тема Weird PL/Python elog output
Дата
Msg-id 1256914412.525.17.camel@fsopti579.F-Secure.com
обсуждение исходный текст
Ответы Re: Weird PL/Python elog output  (Marko Kreen <markokr@gmail.com>)
Список pgsql-hackers
Calling PL/Python's elog functions exposes some curious behavior.  For
example, calling plpy.error('foo') prints

ERROR:  ('foo',)

(instead of the

ERROR:  foo

that one might have hoped for.)  This is an implementation artifact,
because those functions don't check their arguments, just take them as a
tuple, convert the tuple to a string, and a singleton tuples look like
the above as a string.

The simple way to amend this is to force these functions to take exactly
one argument print that.  If people then actually want to pass a tuple,
they should form one explicitly.  This approach might break user's
applications, however, if they have felt free to write things like
plpy.error('error code', n).  Although passing more than one argument is
not documented, so arguably it can't be expected to work.

Other ways to fix this would be: Check if the number of arguments is
one.  If yes, print that; else print the whole tuple.  Or perhaps loop
through all the arguments and explicitly print each separated by a
comma.

Comments?



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

Предыдущее
От: Devrim GÜNDÜZ
Дата:
Сообщение: Re: Syntax for partitioning
Следующее
От: Peter Eisentraut
Дата:
Сообщение: Re: Patch for automated partitioning