From: | john guthrie <jguthrie(at)psynapsetech(dot)net> |
---|---|
To: | pgsql-interfaces(at)postgresql(dot)org |
Subject: | problem with 'copy binary' file format |
Date: | 2003-01-21 20:54:58 |
Message-ID: | 3E2DB3A2.7020503@psynapsetech.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-interfaces |
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.
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2003-01-21 22:19:01 | Re: problem with 'copy binary' file format |
Previous Message | Michiel Lange | 2003-01-21 00:47:22 | Re: Problems compiling with libpq |