Re: Combine psql command with shell script

From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: John Wang <johnw822003(at)yahoo(dot)com>
Cc: Postgres General <pgsql-general(at)postgresql(dot)org>
Subject: Re: Combine psql command with shell script
Date: 2009-03-11 12:20:24
Message-ID: 20090311122024.GB4009@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

John Wang wrote:
>
> How to combine psql commands, such as "\copy", with shell script? Is
> there any sample code? For example, I have 10 tables and want to user
> the "\copy" command to import data from 10 different text files. I can
> execute the "\copy" command 10 times. But it is not convenient.

If the 10 files go into different 10 tables, you have no option but to
call \copy 10 times anyway.

--
Alvaro Herrera http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Marc Cuypers 2009-03-11 12:38:19 Re: SOLVED upgrade from 7.4 to 8.3
Previous Message Gregory Stark 2009-03-11 10:57:08 Re: upgrade from 7.4 to 8.3