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

From Phillip Smith
Subject Re: COPY FROM query.
Date
Msg-id 00d601c74e3f$5fc59940$9b0014ac@wbaus090
Whole thread Raw
In response to Re: COPY FROM query.  (Paul Lambert <paul.lambert@autoledgers.com.au>)
Responses Re: COPY FROM query.
List pgsql-sql
"Having said that, if I switch it to a forward slash it works without
error... odd, given that weenblows standard is backslash."

Yes, but PostgreSQL uses a back-slash as an escape character, which needs to
be used to escape itself at an application level before the O/S gets to deal
with it :)

-p


-----Original Message-----
From: pgsql-sql-owner@postgresql.org [mailto:pgsql-sql-owner@postgresql.org]
On Behalf Of Paul Lambert
Sent: Monday, 12 February 2007 11:09
To: Joe
Cc: pgsql-sql@postgresql.org
Subject: Re: [SQL] COPY FROM query.

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


---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster


*******************Confidentiality and Privilege Notice*******************

The material contained in this message is privileged and confidential to
the addressee.  If you are not the addressee indicated in this message or
responsible for delivery of the message to such person, you may not copy
or deliver this message to anyone, and you should destroy it and kindly
notify the sender by reply email.

Information in this message that does not relate to the official business
of Weatherbeeta must be treated as neither given nor endorsed by Weatherbeeta.
Weatherbeeta, its employees, contractors or associates shall not be liable
for direct, indirect or consequential loss arising from transmission of this
message or any attachments


pgsql-sql by date:

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