Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id DF944475CE7 for ; Tue, 21 Jan 2003 15:56:36 -0500 (EST) Received: from pxdcms01.psynapsetech.net (unknown [208.246.69.99]) by postgresql.org (Postfix) with ESMTP id 852B5475BD7 for ; Tue, 21 Jan 2003 15:56:33 -0500 (EST) Received: from psynapsetech.net ([208.246.69.118]) by pxdcms01.psynapsetech.net (8.11.6/8.11.6) with ESMTP id h0LKYjV16470 for ; Tue, 21 Jan 2003 15:34:45 -0500 Message-ID: <3E2DB3A2.7020503@psynapsetech.net> Date: Tue, 21 Jan 2003 15:54:58 -0500 From: john guthrie User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.2.1) Gecko/20021130 X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-interfaces@postgresql.org Subject: problem with 'copy binary' file format Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200301/88 X-Sequence-Number: 3588 i am having a problem creating a 'copy binary' input file in c on my linux box running postgresql 7.2.2. the error message i get is: ERROR: copy: line 1, pg_atoi: error in "PGBCOPY": can't parse "PGBCOPY" so it looks to me like the header doesn't match what it should. my code creates/writes the header like this: char *bchead = "PGBCOPY\n\377\r\n\0"; unsigned int bcsig = 0x01020304; unsigned int bcflags = 0x0; unsigned int bcext = 0x0; outFile = fopen(tmpfile, "w"); fwrite(bchead,1,12,outFile); fwrite(&bcsig,1,4,outFile); fwrite(&bcflags,1,4,outFile); fwrite(&bcext,1,4,outFile); when i 'od -c' the created file, i see: local jguthrie> od -c /tmp/packets.bin 0000000 P G B C O P Y \n 377 \r \n \0 004 003 002 001 0000020 \0 \0 \0 \0 \0 \0 \0 \0 004 \0 377 377 0000034 (this for a 4-field tuple with no rows in the data file). this all seems to match up with the documentation online: http://www.postgresql.org/idocs/index.php?sql-copy.html any help much appreciated. thanks. john.