Re: Fix PL/Python metadata when there is no result
От | Jean-Baptiste Quenot |
---|---|
Тема | Re: Fix PL/Python metadata when there is no result |
Дата | |
Msg-id | CAK6bCax5ps4qSPzD=6+h8eArfDej3YvssNf919Ge1=8edAbtDQ@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: Fix PL/Python metadata when there is no result (Peter Eisentraut <peter_e@gmx.net>) |
Ответы |
Re: Fix PL/Python metadata when there is no result
|
Список | pgsql-hackers |
2012/2/24 Peter Eisentraut <peter_e@gmx.net>: > On fre, 2012-02-10 at 17:44 +0100, Jean-Baptiste Quenot wrote: >> >> Please find attached a patch that solves this issue. Instead of a PG >> crash, we get the following message: >> >> ERROR: plpy.Error: no result fetched > > Hmm, should it be an error or just return None? Python DB-API > cursor.description returns None if no result set was returned. IMO raising an error is much better because: 1) It is not a valid usecase to retrieve result metadata when no rows are expected to be returned 2) The various metadata methods return a sequence. Checking for null value in this case is not a very good programming style. I expect to find an empty list when no data is available. Cheers, -- Jean-Baptiste Quenot
В списке pgsql-hackers по дате отправления: