Skip site navigation (1) Skip section navigation (2)

Re: Import csv file into multiple tables in Postgres

From: Andrew Hammond <ahammond(at)ca(dot)afilias(dot)info>
To: Deepblues <deepblues(at)gmail(dot)com>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: Import csv file into multiple tables in Postgres
Date: 2005-02-28 02:28:17
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-novice
The brief answer is no, you can not import from a single csv file into 
multiple tables.

If the csv file consists of two distinct sections of data, then you 
could of course split it into two csv files. If what you want to do is 
normalize existing data, then you should first import the existing data 
into a working table. Then you can manipulate it within the database.

It is unlikely that you will need perl to do any of this.

Please post a sample of the data and the schema into which you plan to 
import your data.


Deepblues wrote:
> Hi, 
>    Is it possible to import data from a csv file into multiple tables
> in postgresql database.
> suppose if I have 2 tables students and departments. And my csv file
> contains data for both the tables. Can I import this data into the two
> tables.
> Is there any perl script available to do this. 

In response to


pgsql-novice by date

Next:From: Andrew HammondDate: 2005-02-28 02:38:23
Subject: Re: PL/Pgsql or PL/Python?
Previous:From: DeepbluesDate: 2005-02-27 19:15:58
Subject: Import csv file into multiple tables in Postgres

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group