Re: Assistance in importing a csv file into Postgresql

From: Intengu Technologies <sindile(dot)bidla(at)gmail(dot)com>
To: Stephen Frost <sfrost(at)snowman(dot)net>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Assistance in importing a csv file into Postgresql
Date: 2009-05-26 05:29:37
Message-ID: a1afa64b0905252229s3689be92mfe07d55b655e6b1f@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Thanks for the pointers will try them.

On 25/05/2009, Stephen Frost <sfrost(at)snowman(dot)net> wrote:
> Greetings,
>
> * Intengu Technologies (sindile(dot)bidla(at)gmail(dot)com) wrote:
>> What I would like to do is
>>
>> If field1=1 make table1 and insert the rest of field1=1 into this table
>> If field1=2 make table2 and insert the rest of field1=2 into this table
>>
>> Hence in this example one will have table1, table2, table3, table4,
>> table5 and table6
>>
>> How can I accomplish this using the COPY command.
>
> This currently can't be done with the COPY command directly. There are
> a couple of options:
>
> #1- Have a single table with a trigger on it that does this for you
> #2- Write a simple perl script which does this for you
> #3- Load the data into one table and then use SQL to move it to the
> other tables (which you would need to create first)
>
> Enjoy,
>
> Stephen
>

--
Sindile Bidla

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Scott Marlowe 2009-05-26 05:45:24 Re: how to delete many rows from a huge table?
Previous Message Intengu Technologies 2009-05-26 05:27:13 Re: Assistance in importing a csv file into Postgresql