Received: from localhost (unknown [200.46.204.184]) by postgresql.org (Postfix) with ESMTP id 113DD9FC01D for ; Wed, 24 Oct 2007 06:19:55 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.184]) (amavisd-maia, port 10024) with ESMTP id 07190-07 for ; Wed, 24 Oct 2007 06:19:28 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.5 Received: from ciao.gmane.org (main.gmane.org [80.91.229.2]) by postgresql.org (Postfix) with ESMTP id 78A9A9FBEC1 for ; Wed, 24 Oct 2007 06:19:50 -0300 (ADT) Received: from list by ciao.gmane.org with local (Exim 4.43) id 1IkcOk-0002HN-Lo for pgsql-sql@postgresql.org; Wed, 24 Oct 2007 09:19:34 +0000 Received: from srv.protecting.net ([212.126.218.242]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 24 Oct 2007 09:19:34 +0000 Received: from hf0217x by srv.protecting.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 24 Oct 2007 09:19:34 +0000 X-Injected-Via-Gmane: http://gmane.org/ To: pgsql-sql@postgresql.org From: Harald Fuchs Subject: Re: request for help with COPY syntax Date: Wed, 24 Oct 2007 11:19:26 +0200 Lines: 32 Message-ID: References: <200710231019.07833.pgsql-list@nullmx.com> <200710231951.18423.aklaver@comcast.net> <200710240059.04348.pgsql-list@nullmx.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: srv.protecting.net X-Archive: encrypt User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1 (gnu/linux) Cancel-Lock: sha1:k8PC3sqKL0z4mPOlGx5U7LpU/z0= X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200710/103 X-Sequence-Number: 29475 In article <200710240059.04348.pgsql-list@nullmx.com>, "Chuck D." writes: > 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? Can't you just say COPY geo.orig_city_maxmind FROM '/home/www/geo/DATA/MAXMIND.com/cities_no_header.txt' DELIMITER ',' ?