Re: unused columns in copy

From: Marcin Stępnicki <mstepnicki(at)gmail(dot)com>
To: chester c young <chestercyoung(at)yahoo(dot)com>
Cc: sql pgsql <pgsql-sql(at)postgresql(dot)org>
Subject: Re: unused columns in copy
Date: 2009-07-20 22:59:44
Message-ID: 179149fe0907201559x3e81028aue0b51ba317c2fbbb@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Mon, Jul 20, 2009 at 3:22 PM, chester c young<chestercyoung(at)yahoo(dot)com> 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/

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message nha 2009-07-21 00:07:03 Re: how to tell if column set on update
Previous Message JJ 2009-07-20 19:59:22 Storing/sorting hex data in PostgreSQL