X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 3F06ADA9F6 for ; Thu, 22 Sep 2005 13:49:27 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 46451-04 for ; Thu, 22 Sep 2005 16:49:24 +0000 (GMT) Received: from hotmail.com (bay108-f22.bay108.hotmail.com [65.54.162.32]) by svr1.postgresql.org (Postfix) with ESMTP id 118AEDA9F4 for ; Thu, 22 Sep 2005 13:49:24 -0300 (ADT) Received: from mail pickup service by hotmail.com with Microsoft SMTPSVC; Thu, 22 Sep 2005 09:49:24 -0700 Message-ID: Received: from 65.54.162.200 by by108fd.bay108.hotmail.msn.com with HTTP; Thu, 22 Sep 2005 16:49:24 GMT X-Originating-IP: [207.236.65.226] X-Originating-Email: [kevinrkeith@hotmail.com] X-Sender: kevinrkeith@hotmail.com In-Reply-To: <20050922145236.GA96171@winnie.fuhr.org> From: "Kevin Keith" To: mike@fuhr.org Cc: pgsql-admin@postgresql.org Subject: Re: Copy command not writing complete data to text file Date: Thu, 22 Sep 2005 11:49:24 -0500 Mime-Version: 1.0 Content-Type: text/plain; format=flowed X-OriginalArrivalTime: 22 Sep 2005 16:49:24.0457 (UTC) FILETIME=[966B3D90:01C5BF95] X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=3.144 required=5 tests=[AWL=-0.438, DNS_FROM_RFC_ABUSE=0.374, DNS_FROM_RFC_POST=1.376, MSGID_FROM_MTA_HEADER=0, RCVD_IN_BL_SPAMCOP_NET=1.832] X-Spam-Level: *** X-Archive-Number: 200509/236 X-Sequence-Number: 18973 It is a CGI (shell) script that is calling a C program. I found the issue - which was external to Postgres. I still have one remaining question - if the COPY to FILE command fails, does it return an error? If the program uses: int i; i = PQexec("copy from <> to <>"); and the table has (for example) 500 records, but only 350 were copied to the file, what is returned in i? Or is the only method to check that all the data was exported correctly to wc -l the file and select count(*) to check against what was supposed to be exported? Thanks, Kevin >From: Michael Fuhr >To: Kevin Keith >CC: pgsql-admin@postgresql.org >Subject: Re: [ADMIN] Copy command not writing complete data to text file >Date: Thu, 22 Sep 2005 08:52:36 -0600 > >On Thu, Sep 22, 2005 at 08:27:00AM -0500, Kevin Keith wrote: > > The platform is Free BSD, Postgres version 7.4.5 and the program >triggering > > the COPY command is a CGI script. > >What language and API are you using? In the next paragraph you >mention PQexec(), which implies C or C++ and libpq (some people >argue that a C/C++ program isn't a "script," so that word could be >misleading). > > > I am copying out to a text files using PQexec - there are no more than >500 > > records in the tables being copied. What is happening, is one instance >of > > the COPY command is always stopping after dumping 16,384 bytes (16K) to >the > > text file - the last record is always truncated (i.e. the if the table >has > > 20 columns, the last record may only have 7 columns in the flat file). > > There is also no error returned in the program - to the program calling >the > > copy command everything gives an appearance of working. > >Could you post the code that does the COPY and error checking? >Better yet, a short but complete program that exhibits the problem. > > > What makes this problem difficult to resolve is that if I run the exact > > same COPY command from the PSQL prompt, everything works with no >problems. > >Does the CGI program behave differently if you run it from the >command line instead of through the web server? > >-- >Michael Fuhr > >---------------------------(end of broadcast)--------------------------- >TIP 1: if posting/reading through Usenet, please send an appropriate > subscribe-nomail command to majordomo@postgresql.org so that your > message can get through to the mailing list cleanly _________________________________________________________________ On the road to retirement? Check out MSN Life Events for advice on how to get there! http://lifeevents.msn.com/category.aspx?cid=Retirement