Re: problem with PQsendQuery/PQgetResult and COPY FROM statement

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: max(dot)poletto(at)gmail(dot)com
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: problem with PQsendQuery/PQgetResult and COPY FROM statement
Date: 2006-05-21 22:15:36
Message-ID: 10370.1148249736@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

max(dot)poletto(at)gmail(dot)com writes:
> I attempt to execute a "COPY test FROM STDIN" using PQsendQuery.
> Subsequently, after the appropriate poll()/PQconsumeInput/PQisBusy
> calls, PQgetResult returns tens of millions of (invalid?) non-null
> PGresults.

You should fix your code to pay some attention to what those results
are. I'm betting they are error results.

> This behavior seems incorrect, and sometimes causes my
> application to exhaust memory and crash.

Well, that's because you're not PQclear'ing a result when done with it.

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2006-05-21 22:43:40 Re: FW: iDefense Q2 2006 Vulnerability Challenge
Previous Message Josh Berkus 2006-05-21 21:58:17 Re: Porting MSSQL to PGSQL (Was: [OT] MySQL is bad, but THIS bad?)