Re: newbie question: reading sql commands from script - Mailing list pgsql-general

From Brent Wood
Subject Re: newbie question: reading sql commands from script
Date
Msg-id 20051026103326.L51409@storm-user.niwa.co.nz
Whole thread Raw
In response to newbie question: reading sql commands from script files  ("basel novo" <baselnovo@hotmail.com>)
Responses Re: newbie question: reading sql commands from script
List pgsql-general

On Tue, 25 Oct 2005, basel novo wrote:

> What is the equivalent of the mysql 'source' command for reading sql
> commands from ascii script files?
>

I have not used mysql, so am not familiar with the source command, but to
have postgres run a set of sql statements/queries from a file you can:

psql <DB> -f "filename"



also, to run a single command from a script (or commandline)

psql <DB> -c "<sql command>"



Cheers,

  Brent Wood

pgsql-general by date:

Previous
From: "Cosmopo"
Date:
Subject: Looking for a command to list schemas
Next
From: Rodrigo Gonzalez
Date:
Subject: Re: querying PostgreSQL version?