Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Data Bases > Pgsql Novice > copy command in...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 2 Topic 3057 of 3175
Post > Topic >>

copy command in Windows XP

by mat@[EMAIL PROTECTED] ("Mat Dodgson") Apr 1, 2008 at 11:15 PM

------=_Part_17341_12245264.1207052119968
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

Hey folks!

First off - been using postgres for a short time and am really impressed!
Much more professional than mysql. When I saw a query plan that actually
looked like a query plan I was very pleased! (maybe I'm being a bit harsh
on
mysql here?)

I'm running postgres 8.3 (just downloaded last week) on my dev machine
(Windows Xp). I have what is probably a very simple question. I'm trying
to
do a bulk insert of up to about 1000 rows using the copy command. I'm
using
php's pdo for the data access. 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.

The data columns are seperated by a tab (they're not shown in this email
properly). Since it's Windows all lines are terminated with both CR and
LF.
searchindustry is a table with 3 columns. The 2 you can see are integer
and
the 3rd column is a serial.

I've examined the data in hex and there are no weird chars in it.

I've pasted the same query into the sql tool in pgadmin 3 and I get
exactly
the same error.

As a side note, if I try to use the copy command to output from a table to
stdout the query never completes (pgadmin 3 crashes and I have to kill it
and restart). This is probably a pgadmin 3 bug.

Any help would be much appreciated.

Thanks!

Mat Dodgson

------=_Part_17341_12245264.1207052119968
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

Hey folks!<br><br>First off - been using postgres for a short time and am
really impressed! Much more professional than mysql. When I saw a query
plan that actually looked like a query plan I was very pleased! (maybe
I&#39;m being a bit harsh on mysql here?)<br>
<br>I&#39;m running postgres 8.3 (just downloaded last week) on my dev
machine (Windows Xp). I have what is probably a very simple question.
I&#39;m trying to do a bulk insert of up to about 1000 rows using the copy
command. I&#39;m using php&#39;s pdo for the data access. Here&#39;s some
example sql I&#39;m sending to the server:<br>
<br>COPY searchindustry (searchsessionid, industrycode) FROM
stdin;<br>289&nbsp;&nbsp;&nbsp; 5110<br>289&nbsp;&nbsp;&nbsp;
5121<br>289&nbsp;&nbsp;&nbsp; 5122<br>289&nbsp;&nbsp;&nbsp;
5123<br>289&nbsp;&nbsp;&nbsp; 5124<br>289&nbsp;&nbsp;&nbsp;
5125<br>289&nbsp;&nbsp;&nbsp; 5126<br>289&nbsp;&nbsp;&nbsp;
5129<br>\.<br><br>The error I get in the postgres query log is
&quot;syntax error at or near
&quot;289&quot; at character 65&quot;. char 65 is the first line of the
data.<br><br>The data columns are seperated by a tab (they&#39;re not
shown in this email properly). Since it&#39;s Windows all lines are
terminated with both CR and LF. searchindustry is a table with 3 columns.
The 2 you can see are integer and the 3rd column is a serial.<br>
<br>I&#39;ve examined the data in hex and there are no weird chars in it.
<br><br>I&#39;ve pasted the same query into the sql tool in pgadmin 3 and
I get exactly the same error.<br><br>As a side note, if I try to use the
copy command to output from a table to stdout the query never completes
(pgadmin 3 crashes and I have to kill it and restart). This is probably a
pgadmin 3 bug.<br>
<br>Any help would be much appreciated.<br><br>Thanks!<br><br>Mat
Dodgson<br><br>

------=_Part_17341_12245264.1207052119968--
 




 2 Posts in Topic:
copy command in Windows XP
mat@[EMAIL PROTECTED] (&  2008-04-01 23:15:19 
Re: copy command in Windows XP
tgl@[EMAIL PROTECTED] (T  2008-04-01 10:44:19 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan13V112 Sun Jul 20 4:35:06 CDT 2008.