Re: cmd-line interface - Mailing list pgsql-general

From Gregory Wood
Subject Re: cmd-line interface
Date
Msg-id 009f01c12503$459a8a50$7889ffcc@comstock.com
Whole thread Raw
In response to cmd-line interface  (Craig Longman <craigl@begeek.com>)
List pgsql-general
> > 2) wrap a file in an explicit transaction
> [snipped]
> > is 2) possible right now?  i can't see anything in the docs, so i think
> > not.  anyway, having this sort of control would really help.  our
> > scripts need to run on various servers, and some things use different
> > syntax for transactions, db2 is 'rollback/commit work'.
>
> Bit trickier this one. I'd do it in perl (you can probably do it in shell,
> but I'm not good enough). Steps would be:
>
> 1. parse command-line parameters
> 2. open pipe to psql with all parameters except "-f filename" (if there)
> 3. write "BEGIN;" to psql
> 4. WHILE not EOF read STDIN/file listed on command-line
> 5. write "COMMIT;" to psql
>
> With the appropriate error-checking etc.

And don't forget to strip out the possible BEGINs and COMMITs in the file
since PostgreSQL doesn't support nested transactions.

Greg


pgsql-general by date:

Previous
From: "Richard Huxton"
Date:
Subject: Re: cmd-line interface
Next
From: Allan Engelhardt
Date:
Subject: Re: Perfomance decreasing