Received: from localhost (unknown [200.46.204.187]) by postgresql.org (Postfix) with ESMTP id 267639FBB81 for ; Wed, 24 Oct 2007 03:59:23 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.187]) (amavisd-maia, port 10024) with ESMTP id 48998-05-2 for ; Wed, 24 Oct 2007 03:59:12 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from k2smtpout06-01.prod.mesa1.secureserver.net (k2smtpout06-01.prod.mesa1.secureserver.net [64.202.189.102]) by postgresql.org (Postfix) with SMTP id 515BF9FBEBA for ; Wed, 24 Oct 2007 03:59:14 -0300 (ADT) Received: (qmail 25748 invoked from network); 24 Oct 2007 06:59:13 -0000 Received: from unknown (HELO mail.servantwebhosting.com) (68.178.159.82) by k2smtpout06-01.prod.mesa1.secureserver.net (64.202.189.102) with ESMTP; 24 Oct 2007 06:59:13 -0000 Received: (qmail 11543 invoked from network); 23 Oct 2007 23:59:11 -0700 Received: from s010600e0296eec95.mj.shawcable.net (HELO shach) (rob@nullmx.com@70.64.195.140) by mail.servantwebhosting.com with SMTP; 23 Oct 2007 23:59:11 -0700 From: "Chuck D." Reply-To: pgsql-list@nullmx.com To: Adrian Klaver , pgsql-sql@postgresql.org Subject: Re: request for help with COPY syntax Date: Wed, 24 Oct 2007 00:59:04 -0600 User-Agent: KMail/1.9.6 References: <200710231019.07833.pgsql-list@nullmx.com> <200710231951.18423.aklaver@comcast.net> In-Reply-To: <200710231951.18423.aklaver@comcast.net> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200710240059.04348.pgsql-list@nullmx.com> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200710/99 X-Sequence-Number: 29471 On October 23, 2007 08:51:18 pm you wrote: > > I got it to work with your sample data by using the COPY command as > follows: COPY geo.orig_city_maxmind > FROM '/home/www/geo/DATA/MAXMIND.com/cities_no_header.txt' > CSV quote as ''''; I see what you are after and you solved the syntax problem I was having, but now I get the same error on a different line: ad,l'aldosa,L'Aldosa,02,42.5833333,1.6333333 I guess it considers that line quoted now. In other words, some lines may have both single and double quotes involved, like this: kz,otdeleniye imeni dvadtsat' vtorogo parts"yezda,Otdeleniye Imeni Dvadtsat' Vtorogo Parts"yezda,10,41.47,69.1280556 Is there any way to tell Postgresql that a CSV file has no quotes around each field, and that each field may have single or double quotes or both?