Re: copy command in Windows XP

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Mat Dodgson" <mat(at)mad(dot)id(dot)au>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: copy command in Windows XP
Date: 2008-04-01 14:44:19
Message-ID: 2015.1207061059@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

"Mat Dodgson" <mat(at)mad(dot)id(dot)au> writes:
> Here's some example sql I'm sending to the server:

> COPY searchindustry (searchsessionid, industrycode) FROM stdin;
> 289 5110
> 289 5121
> 289 5122
> 289 5123
> 289 5124
> 289 5125
> 289 5126
> 289 5129
> \.

> The error I get in the postgres query log is "syntax error at or near "289"
> at character 65". char 65 is the first line of the data.

How are you "sending" this exactly? The error message suggests that
it's all being pushed at the server as one SQL string. That won't work.
The correct implementation requires just sending the COPY command itself
to the server, waiting for it to switch into COPY mode, and then sending
the data (using a different protocol than SQL commands are sent with).

You didn't say, but I gather you're using pgAdmin. I don't know whether
it has any support for copy-from-stdin, but if it does I'm pretty sure
you'd have to provide the data separately from the command. If you
can't find anything like that, you'll have to resort to putting the data
in a file and using copy-from-file instead.

regards, tom lane

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Eyenga, Patty 2008-04-01 14:59:00 PGRcreateConn():Retry. h_errno is 1, reason is 'fe_sendauth: no password supplied
Previous Message Mat Dodgson 2008-04-01 12:15:19 copy command in Windows XP