Re: psql -1 with multiple files?

From: Steve Crawford <scrawford(at)pinpointresearch(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: psql -1 with multiple files?
Date: 2011-12-01 23:28:55
Message-ID: 4ED80DB7.6060004@pinpointresearch.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 12/01/2011 02:01 PM, Jay Levitt wrote:
> Is there a way to load multiple .sql files in a single transaction? It
> looks like "psql -f file1 -f file2" or "psql -f file*" was a WIP patch
> that never happened, and from what I can tell, psql ignores the -1
> parameter when reading from STDIN, so I can't cat them together either:

From the man-page, -1 works in conjunction with -f so you might try:

cat file1 file2 file3 | psql -1 -f - ...

Alternately, since -1 basically wraps your input in a BEGIN...your
statements...COMMIT you could do that yourself with a begin.sql and
commit.sql:

cat begin.sql file1.sql file2.sql ... commit.sql | psql ...

Cheers,
Steve

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Jay Levitt 2011-12-02 00:01:14 Re: psql -1 with multiple files?
Previous Message Jay Levitt 2011-12-01 22:01:08 psql -1 with multiple files?