Re: Transaction aborts on syntax error.

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Rod Taylor <pg(at)rbt(dot)ca>
Cc: Greg Stark <gsstark(at)mit(dot)edu>, PostgreSQL Development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Transaction aborts on syntax error.
Date: 2004-02-12 19:35:42
Message-ID: 200402121935.i1CJZgc17226@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Rod Taylor wrote:
> > > > 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?
> > >
> > > Certainly not if I was typing this from the command line. Imagine the
> > > frustration if the typo was in "DELETE oldtab" and the create statement took
> > > hours.
> >
> > I suppose we could have a SET that psql could set when it was
> > interactive and skip rollback on syntax errors, but that is pretty
> > exotic. Also consider that other errors could abort a query aside from
> > syntax errors, like deadlocks.
>
> Can this be done entirely on the client side?
>
> Have psql silently wrap every statement going out with a BEGIN and a
> COMMIT or ROLLBACK depending on whether there was an error or not?
>
> It depends on subtransactions but those are bound to appear eventually,
> and be infinitely more useful.

Yep, we could do it in the client like we do for autocommit.

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Stef 2004-02-12 19:40:58 RFC: Query Planner making a distinction between Cross Database and Cross Schema ?
Previous Message Tom Lane 2004-02-12 19:21:25 Re: Make length(char(n)) return 'true' length