Re: Combine psql command with shell script

From: John R Pierce <pierce(at)hogranch(dot)com>
To: johnw822003(at)yahoo(dot)com, pgsql-general(at)postgresql(dot)org
Subject: Re: Combine psql command with shell script
Date: 2009-03-11 06:48:28
Message-ID: 49B75EBC.4010309@hogranch.com
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.
>

$ psql .... -f filename.sql

where filename.sql contains whatever stack of commands you wanna run.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message A. Kretschmer 2009-03-11 06:55:40 Re: Combine psql command with shell script
Previous Message John Wang 2009-03-11 06:37:26 Combine psql command with shell script