Re: Fix PL/Python metadata when there is no result

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Fix PL/Python metadata when there is no result
Дата
Msg-id 22029.1333648479@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Fix PL/Python metadata when there is no result  (Peter Eisentraut <peter_e@gmx.net>)
Список pgsql-hackers
Peter Eisentraut <peter_e@gmx.net> writes:
> The alternatives are now to introduce a new function like has_rows()
> that returns True iff result rows exist and therefore result metadata
> can be fetched, or go back to having coltypes() et al. return None when
> no metadata exists.  I'm in favor of the latter, because the former
> would add somewhat needless complications and doesn't really add any
> robustness or the like.

Seems sensible to me.

We had better also document what nrows() really does.  Should we also
introduce a new function that is "number of rows in the resultset",
rather than depending on len()?  I think it might be useful, or at least
consistent, to have a function defined as "number of rows, or None if
the resultset does not contain rows".  In particular, I think it is
important to be able to distinguish between a command result (which
cannot possibly contain rows) and a query result that happens to contain
zero rows.
        regards, tom lane


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

Предыдущее
От: Jean-Baptiste Quenot
Дата:
Сообщение: Re: Fix PL/Python metadata when there is no result
Следующее
От: Robert Haas
Дата:
Сообщение: Re: Last gasp