Re: copy command in Windows XP - Mailing list pgsql-novice

From Tom Lane
Subject Re: copy command in Windows XP
Date
Msg-id 2015.1207061059@sss.pgh.pa.us
Whole thread Raw
In response to copy command in Windows XP  ("Mat Dodgson" <mat@mad.id.au>)
List pgsql-novice
"Mat Dodgson" <mat@mad.id.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

pgsql-novice by date:

Previous
From: "Mat Dodgson"
Date:
Subject: copy command in Windows XP
Next
From: "Eyenga, Patty"
Date:
Subject: PGRcreateConn():Retry. h_errno is 1,reason is 'fe_sendauth: no password supplied