Received: from localhost (maia-1.hub.org [200.46.204.191]) by postgresql.org (Postfix) with ESMTP id 2C6BC9FB387 for ; Mon, 12 Feb 2007 16:34:58 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.191]) (amavisd-new, port 10024) with ESMTP id 27620-04 for ; Mon, 12 Feb 2007 16:34:49 -0400 (AST) X-Greylist: delayed 00:06:57.158476 by SQLgrey-1.7.4 Received: from misuse.org (misuse.org [64.62.234.92]) by postgresql.org (Postfix) with SMTP id 33FE99FB2E8 for ; Mon, 12 Feb 2007 16:34:48 -0400 (AST) Received: from dino-1.misuse.org ([68.122.124.206]) by misuse.org for ; Mon, 12 Feb 2007 12:27:40 -0800 X-Mailer: QUALCOMM Windows Eudora Version 7.1.0.9 Date: Mon, 12 Feb 2007 12:24:13 -0800 To: pgsql-sql@postgresql.org From: Steve Midgley Subject: Re: COPY FROM query In-Reply-To: <20070212190914.1F8439FB616@postgresql.org> References: <20070212190914.1F8439FB616@postgresql.org> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; format=flowed Message-Id: <20070212203449.33FE99FB2E8@postgresql.org> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=1.529 tagged_above=0 required=5 tests=BAYES_50, FORGED_RCVD_HELO, MSGID_FROM_MTA_ID X-Spam-Level: * X-Archive-Number: 200702/153 X-Sequence-Number: 27487 Hi, For what it's worth, WindowsXP (at least) seems to currently support forward slashes at the OS level, so this Postgres behavior isn't as odd as it might seem. If you enclose your paths with double quote (") marks, Windows will even accept Unix style paths for some instructions on the command line: dir "/temp" Feeding Windows API calls with forward slashes seems to work with everything I've tried so far, so using them in Postgres seems perfectly smart, and reasonable.. Hope that helps, Steve At 11:03 AM 2/12/2007, pgsql-sql-owner@postgresql.org wrote: >Date: Mon, 12 Feb 2007 09:09:08 +0900 >From: Paul Lambert >To: Joe >Cc: pgsql-sql@postgresql.org >Subject: Re: COPY FROM query. >Message-ID: <45CFB024.7040207@autoledgers.com.au> > >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