Patches for libpq++ docs and backend/command/copy.c - Mailing list pgsql-bugs

From Tom Vijlbrief
Subject Patches for libpq++ docs and backend/command/copy.c
Date
Msg-id 38FD7E20.6BE44F85@knoware.nl
Whole thread Raw
Responses Re: Patches for libpq++ docs and backend/command/copy.c  (Bruce Momjian <pgman@candle.pha.pa.us>)
List pgsql-bugs

============================================================================
                        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

pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: 7.0RC1 on Linux Alpha
Next
From: "Joshua Jackson"
Date:
Subject: Bug in psql COPY command