Re: cmd-line interface

From: "Gregory Wood" <gregw(at)com-stock(dot)com>
To: "Richard Huxton" <dev(at)archonet(dot)com>
Cc: "PostgreSQL-General" <pgsql-general(at)postgresql(dot)org>
Subject: Re: cmd-line interface
Date: 2001-08-14 20:54:11
Message-ID: 009f01c12503$459a8a50$7889ffcc@comstock.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Bruce Momjian 2001-08-14 20:55:20 Re: Re: Future: Oracle corporation goes bankrupt!! (CIA, KGB, British Intelligence reports)
Previous Message Peter Eisentraut 2001-08-14 20:48:44 Re: Re: Use int8 for int4/int2 aggregate accumulators?