"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
pgsql-novice by date
|Next:||From: Eyenga, Patty||Date: 2008-04-01 14:59:00|
|Subject: PGRcreateConn():Retry. h_errno is 1,reason is 'fe_sendauth: no password supplied|
|Previous:||From: Mat Dodgson||Date: 2008-04-01 12:15:19|
|Subject: copy command in Windows XP|