Thread: Patches for libpq++ docs and backend/command/copy.c

Patches for libpq++ docs and backend/command/copy.c

From
Tom Vijlbrief
Date:

============================================================================
                        POSTGRESQL BUG REPORT TEMPLATE
============================================================================


Your name               :       Tom Vijlbrief
Your email address      :       tom.vijlbrief@knoware.nl


System Configuration
---------------------
  Architecture (example: Intel Pentium)         : Intel PII

  Operating System (example: Linux 2.0.26 ELF)  : Linux 2.3.51

  PostgreSQL version (example: PostgreSQL-6.5.3):   PostgreSQL-6.5.3

  Compiler used (example:  gcc 2.8.0)           : egcs-2.91.66


Please enter a FULL description of your problem:
------------------------------------------------

There are a few bugs in the doc for libpq++.

Incorrect use of lowercase methods (putline should be PutLine)
\et should be \t
\en should be \n
data.putline(".\en") should be data.PutLine("\\.\n")
...

I added a patch as attachment to this mail

I also found that there is a problem when a client
exits when "copy from stdin" is active. Postgres does
not detect that the connection is broken, the postmaster generates
many kilobytes (thousands of lines) of errors:

...
pq_recvbuf: unexpected EOF on client connection
pq_recvbuf: unexpected EOF on client connection
pq_recvbuf: unexpected EOF on client connection
pq_recvbuf: unexpected EOF on client connection
pq_recvbuf: unexpected EOF on client connection
pq_recvbuf: unexpected EOF on client connection
pq_recvbuf: unexpected EOF on client connection
pq_recvbuf: unexpected EOF on client connection
pq_recvbuf: unexpected EOF on client connection
pq_recvbuf: unexpected EOF on client connection
ERROR:  CopyReadAttribute - attribute length too long. line: 4
pq_flush: send() failed: Broken pipe
pq_flush: send() failed: Broken pipe
pq_recvbuf: unexpected EOF on client connection


I added a patch for this problem also.

Note that I'm working on a C++ class derived from PgDatabase
that signals errors by throwing exceptions. I'll submit it when it's
finished...

Please describe a way to repeat the problem.   Please try to provide a
concise reproducible example, if at all possible:
----------------------------------------------------------------------


It can be reproduced by compiling and running the attached program
testbad.cxx
The program wil hang, exiting by hitting ^C (interrupt) wil produce
the error messages

The patched postgres will produce:

pq_recvbuf: unexpected EOF on client connection
pq_flush: send() failed: Broken pipe
pq_recvbuf: unexpected EOF on client connection


If you know how this problem might be fixed, list the solution below:
---------------------------------------------------------------------

two patches attached to mail
Attachment

Re: Patches for libpq++ docs and backend/command/copy.c

From
Bruce Momjian
Date:
> There are a few bugs in the doc for libpq++.
>
> Incorrect use of lowercase methods (putline should be PutLine)
> \et should be \t
> \en should be \n
> data.putline(".\en") should be data.PutLine("\\.\n")
> ...
>
> I added a patch as attachment to this mail

Thanks. I have applied your docs patch.

I think you will find the EOF problem is fixed in 7.0.  If not, please
let us know.

--
  Bruce Momjian                        |  http://www.op.net/~candle
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026