[EMAIL PROTECTED] writes:
> I do not expect PQgetResult to return millions of non-null PGresult
> objects after a PQsendQuery("COPY test FROM STDIN").  I expect exactly
> one non-null result, with a result status of PGRES_COPY_IN.

If you call it exactly once, it'll say that exactly once.  If you keep
calling it "millions of times", it'll keep saying that.

> Moreover, the manual says:

>    If a COPY command is issued via PQexec in a string that could
> contain
>    additional commands, the application must continue fetching results
>    via PQgetResult after completing the COPY sequence. Only when
>    PQgetResult returns NULL is it certain that the PQexec command
> string
>    is done and it is safe to issue more commands.

Indeed.  You forgot to "complete the COPY sequence" before returning
to the PQgetResult loop.  As long as the thing is in COPY mode,
PQgetResult will return a result saying PGRES_COPY_IN.  The point
of this paragraph is that you might want to consider doing more
PQgetResults *after* you've ended COPY mode.

                        regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
       subscribe-nomail command to [EMAIL PROTECTED] so that your
       message can get through to the mailing list cleanly

Reply via email to