Re: [GENERAL] Retrieving query results

2017-08-28 Thread Michael Paquier
On Sun, Aug 27, 2017 at 12:12 AM, Tom Lane wrote: > Michael Paquier writes: >> On Fri, Aug 25, 2017 at 8:10 AM, Tom Lane wrote: >>> I think the real problem occurs where we realloc the array bigger. > >> Looking at the

Re: [GENERAL] Retrieving query results

2017-08-26 Thread Tom Lane
Michael Paquier writes: > On Fri, Aug 25, 2017 at 8:10 AM, Tom Lane wrote: >> I think the real problem occurs where we realloc the array bigger. > Looking at the surroundings, I think that it would be nice to have > pqAddTuple and PQsetvalue set an

Re: [GENERAL] Retrieving query results

2017-08-26 Thread Michael Paquier
On Fri, Aug 25, 2017 at 8:10 AM, Tom Lane wrote: > I think the real problem occurs where we realloc the array bigger. > tupArrSize needs to be kept to no more than INT_MAX --- and, ideally, > it should reach that value rather than dying on the iteration after > it reaches 2^30

Re: [GENERAL] Retrieving query results

2017-08-24 Thread Igor Korot
Hi, On Thu, Aug 24, 2017 at 7:18 PM, Tom Lane wrote: > Igor Korot writes: >> So there is no way to retrieve an arbitrary number of rows from the query? >> That sucks... > > The restriction is on the number of rows in one PGresult, not the total > size of

Re: [GENERAL] Retrieving query results

2017-08-24 Thread Tom Lane
Igor Korot writes: > So there is no way to retrieve an arbitrary number of rows from the query? > That sucks... The restriction is on the number of rows in one PGresult, not the total size of the query result. You could use single-row mode, or use a cursor and fetch some

Re: [GENERAL] Retrieving query results

2017-08-24 Thread Tom Lane
Michael Paquier writes: > On Thu, Aug 24, 2017 at 11:56 PM, Tom Lane wrote: >> I haven't tried it, but it sure looks like it would, if you don't hit >> OOM first. pqAddTuple() isn't doing anything to guard against integer >> overflow. The lack of

Re: [GENERAL] Retrieving query results

2017-08-24 Thread Igor Korot
Michael et al, On Thu, Aug 24, 2017 at 6:57 PM, Michael Paquier wrote: > On Thu, Aug 24, 2017 at 11:56 PM, Tom Lane wrote: >> I haven't tried it, but it sure looks like it would, if you don't hit >> OOM first. pqAddTuple() isn't doing anything to

Re: [GENERAL] Retrieving query results

2017-08-24 Thread Michael Paquier
On Thu, Aug 24, 2017 at 11:56 PM, Tom Lane wrote: > I haven't tried it, but it sure looks like it would, if you don't hit > OOM first. pqAddTuple() isn't doing anything to guard against integer > overflow. The lack of reports implies that no one has ever tried to > retrieve

Re: [GENERAL] Retrieving query results

2017-08-24 Thread Tom Lane
Igor Korot writes: > On Thu, Aug 24, 2017 at 8:51 AM, Tom Lane wrote: >> I think what we need is to (1) introduce some error checking in libpq so >> that it reports an error if the resultset exceeds 2G rows --- right now >> it'll just crash, I fear, and

Re: [GENERAL] Retrieving query results

2017-08-24 Thread Igor Korot
Hi, guys, On Thu, Aug 24, 2017 at 8:51 AM, Tom Lane wrote: > Michael Paquier writes: >> On Wed, Aug 23, 2017 at 3:19 AM, Igor Korot wrote: >>> [quote] >>> PQntuples >>> >>> Returns the number of rows (tuples) in the query

Re: [GENERAL] Retrieving query results

2017-08-24 Thread Tom Lane
Michael Paquier writes: > On Wed, Aug 23, 2017 at 3:19 AM, Igor Korot wrote: >> [quote] >> PQntuples >> >> Returns the number of rows (tuples) in the query result. Because it >> returns an integer result, large result sets might overflow the return

Re: [GENERAL] Retrieving query results

2017-08-22 Thread Igor Korot
Hi, Michael, On Tue, Aug 22, 2017 at 8:32 PM, Michael Paquier wrote: > On Wed, Aug 23, 2017 at 3:19 AM, Igor Korot wrote: >> [quote] >> PQntuples >> >> Returns the number of rows (tuples) in the query result. Because it >> returns an integer

Re: [GENERAL] Retrieving query results

2017-08-22 Thread Michael Paquier
On Wed, Aug 23, 2017 at 3:19 AM, Igor Korot wrote: > [quote] > PQntuples > > 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. > > int

[GENERAL] Retrieving query results

2017-08-22 Thread Igor Korot
Hi, ALL, [quote] PQntuples 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. int PQntuples(const PGresult *res); [/quote] Is there another way to not to overflow the