Skip site navigation (1) Skip section navigation (2)

copy command in Windows XP

From: "Mat Dodgson" <mat(at)mad(dot)id(dot)au>
To: pgsql-novice(at)postgresql(dot)org
Subject: copy command in Windows XP
Date: 2008-04-01 12:15:19
Message-ID: 187b70150804010515x22fe773by52d54371a32a5201@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-novice
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

Responses

pgsql-novice by date

Next:From: Tom LaneDate: 2008-04-01 14:44:19
Subject: Re: copy command in Windows XP
Previous:From: Michael SwierczekDate: 2008-04-01 02:10:37
Subject: Re: Making a database connection persists in PHP

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group