>Bruce Momjian wrote
> Zeugswetter Andreas SB SD wrote:
> > 
> > >> Improving on "not ideal" would be good, and would get even closer
to
> > >> full Oracle/SQLServer migration/compatibility. However, since
I've
> never
> > >> looked at that section of code, I couldn't comment on any
particular
> > >> approach nor implement such a change, so I'll shut up and be
patient.
> > >
> > > Imagine this:
> > >
> > >   BEGIN WORK;
> > >   LOCK oldtab;
> > >   CREATE_X TABLE newtab AS SELECT * FROM oldtab;
> > >   DELETE oldtab;
> > >   COMMIT
> > >
> > > In this case, you would want the database to abort on a syntax
error,
> right?
> >
> > Yeah, but in other db's this is solved by the frontend. e.g. in
Informix
> > dbaccess has a mode that simply stops execution upon first error. So
I
> don't
> > think this is a nogo argument, if we added such a feature to psql.
> 
> Stops execution on the first error?  What does that mean?  It means it
> stops reading the rest of the command file?  We might be able to do
> that (invalidate the entire session), but is that desired?

I wouldn't want to stop execution on the first error. All of that
transaction stuff doesn't apply to batch execution of script files - the
script is being executed blind, so having a decision point mid-way thru
a transaction isn't that important. This thread wasn't originally about
psql behaviour, though if we divert in that direction....I could see a
use for:

\if error then quit "newtab create failed"
or something like that

or even:
\retry on       (with default=off)
to automatically submit an SQL statement if it fails with a retryable
error

Regards, Simon Riggs


---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

               http://www.postgresql.org/docs/faqs/FAQ.html

Reply via email to