Re: PQntuples return type

Поиск
Список
Период
Сортировка
От Bruce Momjian
Тема Re: PQntuples return type
Дата
Msg-id 200709260845.l8Q8jsv15466@momjian.us
обсуждение исходный текст
Ответ на Re: PQntuples return type  ("Greg Sabino Mullane" <greg@turnstep.com>)
Ответы Re: PQntuples return type  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general
Greg Sabino Mullane wrote:
> > So, my doubt is: if the return type is int instead of unsigned int,
> > is this function testable for negative return values?
>
> A quick glance at the code in fe-exec.c and fe-protocol3.c shows that
> the underlying variable starts at 0 as an int and in incremented by
> one every row, so it seems possible that it could wrap around for
> very large results sets and/or boxes with a low representation of 'int'.
> There may be some other safeguards in place I did not see to prevent this,
> but I don't see a reason why we shouldn't use unsigned int or
> unsigned long int here, both for ntups and the return value of the
> function.

On second thought, I have at least updated the function documentation:

       Returns the number of rows (tuples) in the query result.  Because
       it returns an integer result, large result sets might overflow the
       return value on 32-bit operating systems.

--
  Bruce Momjian  <bruce@momjian.us>          http://momjian.us
  EnterpriseDB                               http://www.enterprisedb.com

  + If your life is a hard drive, Christ can be your backup. +

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

Предыдущее
От: Bruce Momjian
Дата:
Сообщение: Re: PQntuples return type
Следующее
От: hubert depesz lubaczewski
Дата:
Сообщение: 8.3devel, csvlog, missing info?