Thread: simple COPY FROM issue
Hello:
A follow up question that may clear this all up:
Is the ‘filename’ relative to the server machine or the client where pgAdmin is running?
Kevin Duffy
WR Capital Management
40 Signal Rd
Stamford, CT
203-504-6221
The file must be on the server. IIRC, with COPY FROM (as opposed to COPY TO) the path can be relative to the server process dir but it's probably a good idea to always use an absolute path. If you wish to copy from the client machine you can use \copy within psql. b Kevin Duffy wrote: > Hello: > > > > A follow up question that may clear this all up: > > > > Is the 'filename' relative to the server machine or the client where > pgAdmin is running? > > > > > > Kevin Duffy > > WR Capital Management > > 40 Signal Rd > > Stamford, CT > > 203-504-6221 > > > >
This worked where E: is on the database server copy imagineoptions from 'E:\\ORGDAT~1\\data\\xxxPositions\\20081112_Options.csv' DELIMITERS ',' CSV ; This does not work fileprint-01 is a different server. copy imagineoptions from \\fileprint-01\Company\xxx\Benchmarking\xxxPositions\20081112_Options.cs v DELIMITERS ',' CSV ; So the COPY FROM command in Postgres can not handle a URL Thanks for your attention to this matter. KD -----Original Message----- From: pgsql-general-owner@postgresql.org [mailto:pgsql-general-owner@postgresql.org] On Behalf Of brian Sent: Wednesday, November 12, 2008 5:38 PM To: pgsql-general@postgresql.org Subject: Re: [GENERAL] simple COPY FROM issue The file must be on the server. IIRC, with COPY FROM (as opposed to COPY TO) the path can be relative to the server process dir but it's probably a good idea to always use an absolute path. If you wish to copy from the client machine you can use \copy within psql. b Kevin Duffy wrote: > Hello: > > > > A follow up question that may clear this all up: > > > > Is the 'filename' relative to the server machine or the client where > pgAdmin is running? > > > > > > Kevin Duffy > > WR Capital Management > > 40 Signal Rd > > Stamford, CT > > 203-504-6221 > > > > -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general
On Thu, Nov 13, 2008 at 10:18:56AM -0500, Kevin Duffy wrote: > This worked where E: is on the database server > copy imagineoptions > from 'E:\\ORGDAT~1\\data\\xxxPositions\\20081112_Options.csv' > DELIMITERS ',' CSV ; > > > This does not work fileprint-01 is a different server. > copy imagineoptions > from > \\fileprint-01\Company\xxx\Benchmarking\xxxPositions\20081112_Options.cs > v > DELIMITERS ',' CSV ; Is this exactly what you entered? if it is, you're missing quotes and escaping. You probably want something more similar to this: COPY imagineoptions FROM E'\\\\fileprint-01\\Company\\xxx\\Benchmarking\\xxxPositions\20081112_Options.csv' WITH CSV; > So the COPY FROM command in Postgres can not handle a URL Postgres doesn't handle URL's, but that's not what you entered. At most, you entered a UNC path (I believe, it's been a *long* time since I had to deal with these under windows) and not a URL. UNC paths always used to be handled transparently by the operating system and didn't need any special handling from normal processes, e.g. a Postgres server. If you could enter the command exactly as you entered it and also include the response back from the server that may help to narrow things down a bit. Sam