Received: from localhost (maia-4.hub.org [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id 500BA9FB534 for ; Sun, 11 Feb 2007 20:47:39 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-new, port 10024) with ESMTP id 71057-06 for ; Sun, 11 Feb 2007 20:47:36 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from weatherbeeta.com.au (218-214-212-153.people.net.au [218.214.212.153]) by postgresql.org (Postfix) with SMTP id 752E99FB524 for ; Sun, 11 Feb 2007 20:47:35 -0400 (AST) Received: (qmail 8826 invoked from network); 12 Feb 2007 00:47:32 -0000 X-NetworkBox-HamSign: 0101;OUT;wbeetaau1;249ec4fa21f38c6e0ae53621d7ca1f4c; Received: from mail.weatherbeeta.com.au (10.10.0.2) by network-box.weatherbeeta.com.au with SMTP; 12 Feb 2007 00:47:32 -0000 Received: (qmail 3009 invoked by uid 1166); 12 Feb 2007 11:47:32 +1100 Received: from 172.20.0.155 by mail.weatherbeeta.com.au (envelope-from , uid 1165) with qmail-scanner-1.25-st-qms (clamdscan: 0.88.6/2315. perlscan: 1.25-st-qms. Clear:RC:1(172.20.0.155):. Processed in 0.38025 secs); 12 Feb 2007 00:47:31 -0000 X-Antivirus-mail.weatherbeeta.com.au-Mail-From: phillip.smith@weatherbeeta.com.au via mail.weatherbeeta.com.au X-Antivirus-mail.weatherbeeta.com.au: 1.25-st-qms (Clear:RC:1(172.20.0.155):. Processed in 0.38025 secs Process 2995) Received: from it-phil.weatherbeeta.com.au (HELO wbaus090) (172.20.0.155) by mail.weatherbeeta.com.au with SMTP; 12 Feb 2007 11:47:29 +1100 From: "Phillip Smith" To: "'Paul Lambert'" , "'Joe'" Cc: Subject: Re: COPY FROM query. Date: Mon, 12 Feb 2007 11:47:29 +1100 Organization: Weatherbeeta Pty Ptd Message-ID: <00d601c74e3f$5fc59940$9b0014ac@wbaus090> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook, Build 10.0.6626 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2962 In-Reply-To: <45CFB024.7040207@autoledgers.com.au> Importance: Normal X-Scanned-By-wbeetaau1: Virus scan performed by network-box X-Scanned-By-wbeetaau1: Scanner file id is wbeetaau1-1171241252.808-8817-000 X-Scanned-By-wbeetaau1: No known viruses found in message (received+scanned in 0.02/0.11 secs) X-Scanned-By-wbeetaau1: Spam-Check-Result: No, hits=0 required=7 tests= autolearn=no version=2.0 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200702/134 X-Sequence-Number: 27468 "Having said that, if I switch it to a forward slash it works without=20 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, >=20 > 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=20 >> inside the copy. >> >> The following is my command: >> >> COPY (SELECT DISTINCT ON (dealer_id,appraisal_id) * FROM=20 >> appraisals_temp) TO 'c:\autodrs_appraisal_new.txt' WITH DELIMITER AS = '^'=20 >> 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) >=20 > 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'. >=20 > Joe >=20 >=20 > ---------------------------(end of = broadcast)--------------------------- > TIP 5: don't forget to increase your free space map settings >=20 >=20 If this is the case, it is strange that the first copy statement works=20 as that is also only using a single backslash. Having said that, if I switch it to a forward slash it works without=20 error... odd, given that weenblows standard is backslash. Thanks for the help though. --=20 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