Re: COPY FROM query. - Mailing list pgsql-sql

From Joe
Subject Re: COPY FROM query.
Date
Msg-id 1171238135.783.2.camel@pampa
Whole thread Raw
In response to COPY FROM query.  (Paul Lambert <paul.lambert@autoledgers.com.au>)
Responses Re: COPY FROM query.  (Paul Lambert <paul.lambert@autoledgers.com.au>)
List pgsql-sql
Hi Paul,

On Mon, 2007-02-12 at 08:19 +0900, Paul Lambert wrote:
> I'm attempting to copy from a table into a file using a select query 
> inside the copy.
> 
> The following is my command:
> 
> COPY (SELECT DISTINCT ON (dealer_id,appraisal_id) * FROM 
> appraisals_temp) TO 'c:\autodrs_appraisal_new.txt' WITH DELIMITER AS '^' 
> CSV HEADER;
> 
> I get the following returned:
> 
> WARNING:  nonstandard use of escape in a string literal
> LINE 1: ...ealer_id,appraisal_id) * FROM appraisals_temp) TO 'C:\autodr...
>                                                               ^
> HINT:  Use the escape string syntax for escapes, e.g., E'\r\n'.
> 
> ERROR: relative path not allowed for COPY to file
> SQL state: 42602
> 
> 
> (The caret character is pointing to the M in FROM)

I believe that on Windows you need to use double backslashes, i.e., 'c:\
\autodrs_appraisal_new.txt', although the regular slash may also work,
i.e., 'c:/autodrs_appraisal_new.txt'.

Joe



pgsql-sql by date:

Previous
From: Paul Lambert
Date:
Subject: Re: COPY FROM query.
Next
From: Paul Lambert
Date:
Subject: Re: COPY FROM query.