Received: from maia.hub.org (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id 2EECF63529C for ; Mon, 20 Jul 2009 20:02:34 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 12076-02 for ; Mon, 20 Jul 2009 20:02:23 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-ew0-f223.google.com (mail-ew0-f223.google.com [209.85.219.223]) by mail.postgresql.org (Postfix) with ESMTP id F2C3F634176 for ; Mon, 20 Jul 2009 19:59:46 -0300 (ADT) Received: by ewy23 with SMTP id 23so2707379ewy.19 for ; Mon, 20 Jul 2009 15:59:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=34aQdTlzd9XZCfp4DwggyiMIYRSXbMf4UMKF7awCHg8=; b=miieeuYhKlB72sNo28dKSB92RGR3zNJ/mR16PJDlQb9ZHYsMQ4jPRLh557yNZeoTWz FtqpD5dGGUKjVjrLx9cag2F3PZGZPiErBOo0FcIgYXjtUUnZTG4sm81OzSkBLMjtkEXQ XxoL/W6Xclk7Kvv8UvFly7VxX1ecqMVFXgDUs= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=HOStoKuI/PreKZ6AUgePpniQ+bfdTVetzGRpx/ddUvXc0VV82OO5Fv4HnbLE2pNcU3 xzOb2UWK04gooWzqZuJZECzw1rVkTaUQo2CD231I9TIjZJSJXS/kCVvxVDU4e26Z8zby 1BhxbpA8nlV4S3eSuhk9+pCmMuvCdYwd9vPFA= MIME-Version: 1.0 Received: by 10.216.49.209 with SMTP id x59mr1292108web.195.1248130784322; Mon, 20 Jul 2009 15:59:44 -0700 (PDT) In-Reply-To: <471945.42509.qm@web54306.mail.re2.yahoo.com> References: <471945.42509.qm@web54306.mail.re2.yahoo.com> Date: Tue, 21 Jul 2009 00:59:44 +0200 Message-ID: <179149fe0907201559x3e81028aue0b51ba317c2fbbb@mail.gmail.com> Subject: Re: unused columns in copy From: =?UTF-8?Q?Marcin_St=C4=99pnicki?= To: chester c young Cc: sql pgsql Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests=none X-Spam-Level: X-Archive-Number: 200907/86 X-Sequence-Number: 32827 On Mon, Jul 20, 2009 at 3:22 PM, chester c young wrote: > > is there a way for COPY FROM to ignore unused columns in CSV? > > in other words, if table t1 has columns c1, c2, and if csv has columns c1, c3, c2, could I do something like > > COPY t1( c1, null, c2 ) FROM 'file.csv' No, but you can use pgloader which can easily deal with your problem and much more. http://pgfoundry.org/projects/pgloader/