From: | "Richard Huxton" <dev(at)archonet(dot)com> |
---|---|
To: | "Craig Longman" <craigl(at)begeek(dot)com>, "pgsql-general" <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: cmd-line interface |
Date: | 2001-08-14 18:34:58 |
Message-ID: | 003901c124ef$d3c0dbe0$1001a8c0@archonet.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
From: "Craig Longman" <craigl(at)begeek(dot)com>
> but... one thing i do like about the db2 app, is that on the cmd-line i
> can specify two things:
>
> 1) stop on error
> this seems to be doable through the env-var ON_ERROR_STOP, but i do wish
> it was also parm i could pass on the cmd-line to psql. its just so much
> easier than setting the everytime i want the stop behaviour. i guess i
> could just set it and leave it.
Wrap psql in a 2-line shellscript which sets the env-var for you.
> 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.
HTH
- Richard Huxton
From | Date | Subject | |
---|---|---|---|
Next Message | Gilles DAROLD | 2001-08-14 18:42:58 | OpenLDAP - Postgresql HOWTO |
Previous Message | Matthew Bellew | 2001-08-14 18:33:57 | Re: Searchable documentation (www.opensql.org) |