Re: COPY FROM query.

From: Paul Lambert <paul(dot)lambert(at)autoledgers(dot)com(dot)au>
To: Joe <dev(at)freedomcircle(dot)net>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: COPY FROM query.
Date: 2007-02-12 00:09:08
Message-ID: 45CFB024.7040207@autoledgers.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Joe wrote:
> 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
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: don't forget to increase your free space map settings
>
>

If this is the case, it is strange that the first copy statement works
as that is also only using a single backslash.

Having said that, if I switch it to a forward slash it works without
error... odd, given that weenblows standard is backslash.

Thanks for the help though.

--
Paul Lambert
Database Administrator
AutoLedgers

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Phillip Smith 2007-02-12 00:47:29 Re: COPY FROM query.
Previous Message Joe 2007-02-11 23:55:35 Re: COPY FROM query.