X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 23AE19DCC0D for ; Wed, 22 Mar 2006 08:24:01 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 30505-03 for ; Wed, 22 Mar 2006 08:24:04 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from matrix.gatewaynet.com (host2.dynacom.ondsl.gr [62.103.35.210]) by postgresql.org (Postfix) with ESMTP id 6825C9DCDB6 for ; Wed, 22 Mar 2006 08:23:51 -0400 (AST) Received: from matrix.gatewaynet.com (localhost.localdomain [127.0.0.1]) by matrix.gatewaynet.com (8.12.8/8.12.8) with ESMTP id k2MDTuOp031367; Wed, 22 Mar 2006 15:29:56 +0200 Received: from localhost (achill@localhost) by matrix.gatewaynet.com (8.12.8/8.12.8/Submit) with ESMTP id k2MDTuIW031363; Wed, 22 Mar 2006 15:29:56 +0200 Date: Wed, 22 Mar 2006 15:29:56 +0200 (EET) From: Achilleus Mantzios To: ivan marchesini cc: pgsql-sql@postgresql.org Subject: Re: COPY tablename FROM and null values In-Reply-To: <1143026331.4730.23.camel@geologia5.agora.ing.unipg.it> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=ISO-8859-7 Content-Transfer-Encoding: 8BIT X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.113 required=5 tests=[AWL=0.113] X-Spam-Score: 0.113 X-Spam-Level: X-Archive-Number: 200603/348 X-Sequence-Number: 24694 O ivan marchesini έγραψε στις Mar 22, 2006 : > Dear users, > I'm working on a Postgres 7.4 server > > I have a .txt file, containing some tabular data, where data are > delimited by TABs. > there are 3 columns: > > column1 int4, column2 float8, column3 float8 > > the problem is that column3 contains also null values (i.e. sometimes is > empty) > > so when I try to use COPY tablename FROM 'filename.txt' I obtain an > error > > I have tried also using " WITH NULL AS ' ' " but without good results... > > can someone explain me how to solve this problem??? batch edit your file (with sed,awk,perl,C,java,...) and build your explicit INSERT statements in some version of your file. > > thank you very much > > Ivan > > > > > -- -Achilleus